如何从DirectProxy的配置中访问TreeStore-Instance中的getTree函数?像这样等等没有用......
有人能帮助我吗?
Ext.define('PM.store.Projects', {
extend: 'Ext.data.TreeStore',
model: 'PM.model.Project',
autoLoad: true,
/*proxy: {
type: 'ajax',
url: 'data/projectTree.json',
reader: {
type: 'json',
},
},
root: {
name: 'Test',
id: -1,
}*/
proxy: {
type: 'direct',
directFn: PM.controller.Projects.getTree,
},
/*root: {
name: 'Demo',
children: [
{
name: 'Test',
leaf: true,
},
],
},*/
getTree: function() {
alert("Test");
}
});
答案 0 :(得分:0)
你可以在我想的构造函数中构建你的代理。
Ext.define('PM.store.Projects', {
extend: 'Ext.data.TreeStore',
model: 'PM.model.Project',
autoLoad: true,
constructor: function(config) {
var me = this;
Ext.apply(me, config);
me.proxy = {
type: 'direct',
directFn: me.getTree
};
me.callParent();
},
getTree: function() {
alert("Test");
}
});