嗨,谁能告诉 ho 在商店里选一个字段我做了一个嵌套列表,我希望当有人点击一个叶子时,消息有些哎呀,你点击一个叶子。叶子是一个布尔场。这是我所拥有的:
new Ext.NestedList({
title: 'Categorieën',
store: NestedListDemo.Groepen_Store,
flex: 1,
listeners:
{
itemtap: function(item)
{
if (leaf==true)
{
Ext.Msg.alert('Oops', 'leaf clicked', Ext.emptyFn);
}
}
}
}),
但我不知道如何使用Sencha Touch做到这一点。
我对这个叶属性存在的地方有点困惑。如果您查看嵌套列表的文档,您将看到列表将触发一个itemtap
事件和一个leafitemtap
事件。我的建议是使用leafitemtap来仅获取叶子项目上的事件。
因此,如果您使用该函数更改代码:
listeners:{
leafitemtap: function(sublist, index, element, event, card){
Ext.Msg.alert('Oops', 'leaf clicked', Ext.emptyFn);
//find the item
var item = sublist.store.getAt(index);
//then you can do something with the item
//item.get('leaf')
//sublist.store.remove(item)
}
}