EXTJS4 - 对于TreeStore,如何传递参数和操作方法?
我正在使用 Extjs4 TreeStore,我想知道如何传递参数(如 mode = 'list')和操作方法(POST 或 GET)。
提前致谢。
EXTJS 3.xi 已经这样使用,它工作正常:
loader: new Ext.tree.TreeLoader({
dataUrl: 'content/permissions/server.php',
baseParams: {
mode: 'getPermissions'
}
})
EXTJS 4.xi 已经这样使用,但它不起作用:
Ext.create('Ext.data.TreeStore', {
autoLoad: true,
proxy: {
type: 'ajax',
url: 'server.php'
},
extraParams: {
mode: 'getTree'
},
actionMethods: 'POST',
root: {
text: 'Tree',
id: 'src',
expanded: true
}
});
谢谢, 里亚兹
I am using Extjs4 TreeStore, i want to know how to pass parameters (like mode = 'list') and action methods (POST or GET).
Thanks in advance.
EXTJS 3.x i have used like this it's working fine:
loader: new Ext.tree.TreeLoader({
dataUrl: 'content/permissions/server.php',
baseParams: {
mode: 'getPermissions'
}
})
EXTJS 4.x i have used like this but it is not working:
Ext.create('Ext.data.TreeStore', {
autoLoad: true,
proxy: {
type: 'ajax',
url: 'server.php'
},
extraParams: {
mode: 'getTree'
},
actionMethods: 'POST',
root: {
text: 'Tree',
id: 'src',
expanded: true
}
});
Thanks,
Riyaz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该使用当前的 Ext 仔细检查您的配置参数JS 4 API 文档。
我第一眼看到的是:
actionMethods 是一个对象,而不是字符串值配置。它在 AJAX 和 REST 代理中实现。如果您需要功能齐全的可编辑树,请考虑使用 REST 代理。仅当您超出 CRUD 范围时,才需要向 REST 代理提供额外的
actionMethods
。extraParams 属于到代理而不是树配置。
因此,您的商店配置应如下所示:
您是否已验证是否至少已将 Ajax 请求发送到服务器?您可以使用 FireBug 轻松检查这一点。
You should carefully check your configuration parameters with the current Ext JS 4 API Documentation.
What I see at first glance:
actionMethods is an object and not a string value configuration. It's implemented in both the AJAX and the REST proxies. If your need a full featured editable tree, consider a REST proxy. Only if you go beyond CRUD, you need to provide additional
actionMethods
to the REST proxy.extraParams belongs to the Proxy and not to the tree configuration.
So your store configuration should look like:
Have you verified if at least an Ajax request has been sent to the server? You can easily check this with FireBug.
正确设置示例:
example of correct setting:
这是正确的
This the correct one