一直想使用 extjs5 treeStroe with Proxy 方式一次性load 所有树形结构数据,结果没成功,
treeStroe 在每次点击展开的时候都会发起请求到后台,url里面还增加node参数。
只能做成异步加载了。每次只load 当前节点的子节点。
treepanel:
treeStroe 在每次点击展开的时候都会发起请求到后台,url里面还增加node参数。
只能做成异步加载了。每次只load 当前节点的子节点。
Ext.define('publicweb.store.MenuTreeStore', {
extend: 'Ext.data.TreeStore',
requires: [
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'MenuTreeStore',
autoLoad: false,
proxy: {
type: 'ajax',
url: 'menu.json',
reader: {
type: 'json',
rootProperty: 'items'
}
}
}, cfg)]);
}
});
treepanel:
{
xtype: 'treepanel',
store: 'MenuTreeStore',
viewConfig: {
}
}