gpt4 book ai didi

kendo-ui - 如何在 KendoMobileListView 中获取所选项目的索引

转载 作者:行者123 更新时间:2023-12-02 22:30:23 29 4
gpt4 key购买 nike

我想知道如何在 Kendo 移动 ListView 中获取所选项目的索引。这是我的代码

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);
}
});

当我运行它时,它给我一个错误提示

TypeError: Object [object Object] has no method 'select'

我需要在这里做什么?如何获取所选项目的索引?干杯

最佳答案

尝试一下:

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);
}
});
}

关于kendo-ui - 如何在 KendoMobileListView 中获取所选项目的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12368467/

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