我从 dojox/mobile
创建一个 EdgeToEdgeStoreList,如下所示:
<ul id="listCustomers"></ul>
storeCustomers = new Memory({data: data, idProperty: "label"});
var listCustomers = new EdgeToEdgeStoreList({
select: "single",
store: storeCustomers
}, "listCustomers");
listCustomers.startup();
然后我想处理onCheckStateChanged
事件:
var listCustomers = dom.byId("listCustomers");
on(listCustomers, "checkStateChanged", function (listItem, newState) {
console.log(listItem, newState);
});
但这永远不会触发。 正确的方法是什么?
这也是一种获取所选项目数组的方法(当然,在我的具体情况下只有一个)。
最佳答案
有两种方法可以做到这一点,或者使用 listitems onclick,或者如果您想使用 checkStateChanged,则必须添加该监听器小部件。
var listCustomers = dijit.registry.byId("listCustomers");
on(listCustomers, "checkStateChanged", function (listItem, newState) {
console.log(listItem, newState);
});
关于javascript - 处理dojo EdgeToEdgeStoreList事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40174864/