开发者

select a field in store

hi can anyone tell ho to selct a field in a store i made a nestedlist and i want when someone clicks on a leaf the message somes oops, you click on a leaf. and leaf is a boolean field. this is what i have:

        new Ext.NestedList({
            tit开发者_JS百科le: 'Categorieën',
            store: NestedListDemo.Groepen_Store,
            flex: 1,
            listeners:
                {
                 itemtap: function(item)
                    {
                        if (leaf==true)
                        {
                        Ext.Msg.alert('Oops', 'leaf clicked', Ext.emptyFn); 
                        }
                    }
                }
        }),

but i have no idea how to do that with sencha touch.


I'm a little confused about where this leaf property exists. If you take a look at the documents for the NestedList, you will see that there is both an itemtap and a leafitemtap event that the list will fire. My recommendation would be to use the leafitemtap to only get events on the items which are leafs.

So if you alter your code using that function:

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

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜