gpt4 book ai didi

javascript - Kendo 组合框使用虚拟检索所选项目

转载 作者:行者123 更新时间:2023-11-27 22:39:28 24 4
gpt4 key购买 nike

我有一个启用虚拟的剑道组合框,我想检索所选项目,因为之后我需要更多信息。

当我在虚拟加载后选择一个项目时,我得到了未定义的信息。

这是我的代码

$scope.select_item_options = {
dataValueField: "id",
dataTextField: "description_nhl",
template: "#= description #",
virtual: true,
filter: "contains",
change: function(e) {
var selected_index = this.selectedIndex;
if (selected_index < 0) {
delete $scope.work_item.item_id;
} else {
var item = this.dataItem(this.select());
console.log(item);
console.log(this.dataItem(selected_index));
// undefined here
}
$scope.$apply();
},
dataSource: new kendo.data.DataSource({
transport: {
read: {
type: "GET",
url: APP_CONFIG.api.base_url + "/items/itemTypes/AC",
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function(xhr) {
xhr.setRequestHeader('Authorization', storageService.getValue('auth_token'));
},
complete: function(result, status) {
if (result.status !== 200 || !result.responseJSON.fn.result.done) {
return httpService.callbackOnError(result.responseJSON, result.status);
}
}
}
},
schema: {
data: 'data',
total: function(data) {
return data.dataCount;
}
},
serverPaging: true,
serverSorting: true,
serverFiltering: true,
pageSize: 5,
sort: {field: "description", dir: "asc"}
})
};

最佳答案

已解决更改

var item = this.dataItem(this.select());

var item = this.dataItem();

关于javascript - Kendo 组合框使用虚拟检索所选项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38868004/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com