chooseMenu: function(_this) {
//var mycomp = top.Ext.getCmp("my_comp");
var menuTreeStore = Ext.data.StoreManager.lookup('menuTreeStore_'+_this.node);
if (!menuTreeStore) {
menuTreeStore = Ext.create('app.store.MenuTreeStore', {
pid: _this.node,
storeId : 'menuTreeStore_'+_this.node,
myid : _this.node,
mynode : _this.node,
isLoading : 0,
proxy: {
pid: _this.node,
id: _this.node,
node: _this.node
},
listeners: {
nodebeforeexpand: function (_this, eOpts) {
//设置节点id
if(_this.id == "root") {
this.mynode = _this.store.mynode;
} else {
this.mynode = _this.data.id;
}
//isLoading 是否自定义URL加载
this.isLoading = _this.data.isLoading;
//action 自定义URL
this.action = _this.data.action;
},
beforeload: function (store, operation, opts) {
//传参节点id作为子树的父节点
Ext.apply(store.proxy.extraParams, {
node: this.mynode
});
//isloading ==1 如果节点展开动作为加载为自定义URL, 设置proxy的url为指定的action
if(this.isLoading == 1) {
store.proxy.url = this.action;
} else {
store.proxy.url = store.originalUrl || store.proxy.url;
}
},
load: function (store, operation, opts) {
//加载自定义url设为0
this.isLoading = 0;
}
}
})
}
var menuTree = Ext.getCmp("menuTree");
menuTree.setStore(menuTreeStore);
}