ExtJS:directfn 和 TreeStore - 未加载
将 TreeStore 与 directFn 一起使用的正确方法是什么?
我是这样做的:
var categoryStore = Ext.create('Ext.data.TreeStore', {
//storeId:'categoryStore',
autoLoad:true,
root: {
text: 'Menu',
id: 'categoryId',
expanded: true
},
proxy: {
type: 'direct',
directFn: categoryController.getMenuItems,
reader: {
id: 'categoryId'
}
},
fields: ['categoryId', 'text', 'children', 'leaf', 'cls'],
sorters: [{
property: 'leaf',
direction: 'ASC'
}, {
property: 'text',
direction: 'ASC'
}]
});
但我没有得到爱。这是我的数据示例:
[{"method":"getMenuItems","result":{"data":[{"children":[{"leaf":true,"checked":false,"categoryId":1001 ,"text":"XXXXX"}],"success":true},"action":"categoryController","tid":1,"type":"rpc"}]
令人沮丧的是,如果我将数据放入数据节点内并执行简单的 AJAX 调用,它就会起作用。
What's the right way to use a TreeStore with directFn?
Here's how I'm doing it:
var categoryStore = Ext.create('Ext.data.TreeStore', {
//storeId:'categoryStore',
autoLoad:true,
root: {
text: 'Menu',
id: 'categoryId',
expanded: true
},
proxy: {
type: 'direct',
directFn: categoryController.getMenuItems,
reader: {
id: 'categoryId'
}
},
fields: ['categoryId', 'text', 'children', 'leaf', 'cls'],
sorters: [{
property: 'leaf',
direction: 'ASC'
}, {
property: 'text',
direction: 'ASC'
}]
});
But I get no love. Here's sample of my data:
[{"method":"getMenuItems","result":{"data":[{"children":[{"leaf":true,"checked":false,"categoryId":1001,"text":"XXXXX"}],"success":true},"action":"categoryController","tid":1,"type":"rpc"}]
Frustratingly, it works if I put what's inside the data node and do a straightforward AJAX call.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许可以尝试:
另外快速浏览一下这个。
Maybe try:
Also have a quick look at this.