How to update the Nested List/Tree Store in Sencha Touch?

女生的网名这么多〃 提交于 2019-12-12 17:18:47

问题


I have a nested list which must be filled with new data based on what does user select in an Ext.Carousel.

TreeStore.load(newData) // this does not work :(
TreeStore.removeAll() // this works!

It seems that the docs and the forum don't have the answer, cause I have been searching for 2-3 days. Thank you in advance.


回答1:


I've ended up with following solution:

NestedList = Ext.extend(Ext.NestedList, {
    loadData: function(data) {
        this.store.setProxy({
            type:'memory',
            data: data,
            reader: {
                type: 'tree',
                root: 'items'
            }
        });
        this.store.load();
        { // some back taps to make it show the top level
            this.onBackTap();         
            this.onBackTap();         
            this.onBackTap(); }; 
},



回答2:


I believe you are correct. To load new data, try this:

TreeStore.removeAll();
TreeStore.add(newData);


来源:https://stackoverflow.com/questions/6737806/how-to-update-the-nested-list-tree-store-in-sencha-touch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!