Kendo ui 将Javascript事件绑定到KendoUI mobile ListView
我正在使用KendoUI,当用户触摸每个特定的LI项时,我需要触发一些javascript事件。这可能吗?下面是我如何映射它们的。。救命啊 提前感谢:这是新的Kendo ui 将Javascript事件绑定到KendoUI mobile ListView,kendo-ui,Kendo Ui,我正在使用KendoUI,当用户触摸每个特定的LI项时,我需要触发一些javascript事件。这可能吗?下面是我如何映射它们的。。救命啊 提前感谢:这是新的 <ul data-role="listview" data-style="inset" data-type="group"> <li><a data-role="button" data-click="runFunctionOne">Function One</a></li&g
<ul data-role="listview" data-style="inset" data-type="group">
<li><a data-role="button" data-click="runFunctionOne">Function One</a></li>
<li><a data-role="button" data-click="runFunctionTwo">Function Two</a></li>
</ul>
是的,这是可能的
这是JavaScript:
function runFunctionOne() {
alert("Function one pressed");
};
function runFunctionTwo() {
alert("Function two pressed");
};
您忘记了函数名称之前的function关键字,HTML中的函数名称是runFunctionOne而不是functionOne。请记住,您也可以使用单击链接查看文档。参数e允许您访问listview的dataItem,它是控件数据源的子集 像这样
$("#customerList").kendoMobileListView({
dataSource: customerDataSource,
template: '<a>${Company}<span class="k-status-text"> <br />${CustNo}</span></a>',
dataType:"json",
style: "inset",
click: function(e){
var index = $(e.item).index();
var text= $(e.item).index();
alert(e.dataItem.CustNo);
// redirect to
app.navigate("#overview-customer");
},
dataBound: function(e){
alert("Ive been bound");
}
});
你找到办法了吗?OnaBai的答案不起作用,strake的答案要求将listview绑定到数据源。
$("#customerList").kendoMobileListView({
dataSource: customerDataSource,
template: '<a>${Company}<span class="k-status-text"> <br />${CustNo}</span></a>',
dataType:"json",
style: "inset",
click: function(e){
var index = $(e.item).index();
var text= $(e.item).index();
alert(e.dataItem.CustNo);
// redirect to
app.navigate("#overview-customer");
},
dataBound: function(e){
alert("Ive been bound");
}
});