我想在ext.js4.2中将树存储动态绑定到树面板中

I want to dynamically bind tree store into tree panel in ext.js 4.2

本文关键字:动态绑定 存储 ext js4      更新时间:2023-09-26

我想在ext.js 4.2中将树存储绑定到树面板中。我的树商店:

Ext.define('My store', {
    extend: 'Ext.data.TreeStore',
    autoLoad : true,        
    model: 'ria.model.system.TreeProgram',
    root : {
        text : '1depth',
        expanded : false
    },
    proxy: {
        type: 'ajax',
        url: '/json/programlist.json',
        reader: {
            type: 'json',
            rootProperty: 'children',
            successProperty: 'success'
        },
        listeners: {
            exception: function(proxy, response, operation){              
                // some code
            },
            load: function(dataStore, rows, bool) {
                // some code
            }
        }
    }
},

好吧,我会试试下面的。Ext.ComponentQuery.query('#treePanel')[0].bindStore(me.store);在这里,'Ext.ComponentQuery.query('#treePanel')[0]'是树面板。但后来我犯了错误!让我们了解一下将树存储动态绑定到树面板的方法。当做

您需要使用reconfigure函数来动态绑定存储。

重新配置([存储],[列])

使用新的存储和/或列。存储和列也可以作为params。

所以应该是这样的:

Ext.ComponentQuery.query('#treePanel')[0].reconfigure(me.store);