Kendo ui 如何在KendoMobileListView中获取所选项目的索引
我想知道如何在Kendo mobile ListView中获取所选项目的索引。这是我的密码Kendo ui 如何在KendoMobileListView中获取所选项目的索引,kendo-ui,Kendo Ui,我想知道如何在Kendo mobile ListView中获取所选项目的索引。这是我的密码 function loadInformation(){ $('#Template').kendoMobileListView({ dataSource: Info, template: '<table style="width: 100%"><tr><td><p>${a = (typeof data.ServiceLocat
function loadInformation(){
$('#Template').kendoMobileListView({
dataSource: Info,
template: '<table style="width: 100%"><tr><td><p>${a = (typeof data.ServiceLocationCompanyName !== "undefined") ? data.ServiceLocationCompanyName : data.LastName + ", " + data.FirstName}</td><td style="width: 84px"><img src=${data.Icon} /></td></tr></table>',
// Added this event to capture the index of selected Item but was unsuccessful
click: function(){
var index = this.select().index(),
console.log(index);
}
});
我需要在这里做什么?如何获取所选项目的索引?干杯试试这个:
function loadInformation(){
$('#Template').kendoMobileListView({
dataSource: Info,
template: '<table style="width: 100%"><tr><td><p>${a = (typeof data.ServiceLocationCompanyName !== "undefined") ? data.ServiceLocationCompanyName : data.LastName + ", " + data.FirstName}</td><td style="width: 84px"><img src=${data.Icon} /></td></tr></table>',
// Added this event to capture the index of selected Item but was unsuccessful
click: function(e){
var index = $(e.item).index();
var text = $(e.item).text();
console.log('selected item contains text: ',text,' and its index is: ',index);
}
});
}
函数加载信息(){
$('#模板')。kendoMobileListView({
数据来源:Info,
模板:'${a=(typeof data.ServiceLocationCompanyName!==“未定义”)?data.ServiceLocationCompanyName:data.LastName+,“+data.FirstName}”,
//添加此事件以捕获所选项目的索引,但未成功
点击:功能(e){
var index=$(e.item).index();
var text=$(e.item).text();
log('所选项目包含文本:',文本',其索引为:',索引);
}
});
}
function loadInformation(){
$('#Template').kendoMobileListView({
dataSource: Info,
template: '<table style="width: 100%"><tr><td><p>${a = (typeof data.ServiceLocationCompanyName !== "undefined") ? data.ServiceLocationCompanyName : data.LastName + ", " + data.FirstName}</td><td style="width: 84px"><img src=${data.Icon} /></td></tr></table>',
// Added this event to capture the index of selected Item but was unsuccessful
click: function(e){
var index = $(e.item).index();
var text = $(e.item).text();
console.log('selected item contains text: ',text,' and its index is: ',index);
}
});
}