Javascript 剑道组合框使用虚拟键检索所选项目
我有一个启用了虚拟的剑道组合框,我想重新获取所选项目,因为我需要更多信息 当我在虚拟加载后选择一个项目时,我没有定义 这是我的密码Javascript 剑道组合框使用虚拟键检索所选项目,javascript,kendo-ui,kendo-combobox,Javascript,Kendo Ui,Kendo Combobox,我有一个启用了虚拟的剑道组合框,我想重新获取所选项目,因为我需要更多信息 当我在虚拟加载后选择一个项目时,我没有定义 这是我的密码 $scope.select_item_options = { dataValueField: "id", dataTextField: "description_nhl", template: "#= description #", virtual: true, filter: "con
$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"}
})
};
$scope.select_item_选项={
dataValueField:“id”,
dataTextField:“说明”,
模板:“#=说明#”,
虚拟的:是的,
过滤器:“包含”,
更改:功能(e){
var selected_index=this.selectedIndex;
如果(所选索引<0){
删除$scope.work\u item.item\u id;
}否则{
var item=this.dataItem(this.select());
控制台日志(项目);
log(this.dataItem(选中的_索引));
//此处未定义
}
$scope.$apply();
},
数据源:新建kendo.data.dataSource({
运输:{
阅读:{
键入:“获取”,
url:APP_CONFIG.api.base_url+“/items/itemTypes/AC”,
contentType:“应用程序/json;字符集=utf-8”,
数据类型:“json”,
发送前:函数(xhr){
xhr.setRequestHeader('Authorization',storageService.getValue('auth_token');
},
完成:功能(结果、状态){
if(result.status!==200 | |!result.responseJSON.fn.result.done){
返回httpService.callbackOnError(result.responseJSON,result.status);
}
}
}
},
模式:{
数据:'数据',
总计:功能(数据){
返回data.dataCount;
}
},
对,,
对,,
是的,
页面大小:5,
排序:{字段:“描述”,目录:“asc”}
})
};
已解决更改问题
var item=this.dataItem(this.select())代码>
与
var item=this.dataItem()代码>我使用这个.dataItem()没有参数,而且似乎在工作,我正在测试