【问题标题】:How to update the Nested List/Tree Store in Sencha Touch?如何更新 Sencha Touch 中的嵌套列表/树存储?
【发布时间】:2011-10-07 22:40:18
【问题描述】:

我有一个嵌套列表,必须根据用户在 Ext.Carousel 中选择的内容填充新数据。

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

似乎文档和论坛没有答案,因为我已经搜索了 2-3 天。提前谢谢你。

【问题讨论】:

    标签: tree sencha-touch api-design nested-lists


    【解决方案1】:

    我最终得到了以下解决方案:

    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(); }; 
    },
    

    【讨论】:

    • setProxy / load 与内存代理的组合工作得很好!
    【解决方案2】:

    我相信你是对的。要加载新数据,请尝试以下操作:

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

    【讨论】:

    • TreeStore.add() 不存在
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-05
    • 1970-01-01
    相关资源
    最近更新 更多