gpt4 book ai didi

javascript - EXTJS4 - 对于 TreeStore,如何传递参数和操作方法?

转载 作者:行者123 更新时间:2023-11-29 22:32:38 27 4
gpt4 key购买 nike

我正在使用 Extjs4 TreeStore,我想知道如何传递参数(如 mode = 'list')和操作方法(POST 或 GET)。

提前致谢。

EXTJS 3.x 我像这样使用它工作正常:

loader: new Ext.tree.TreeLoader({
dataUrl: 'content/permissions/server.php',
baseParams: {
mode: 'getPermissions'
}
})

我用过 EXTJS 4.x,但它不起作用:

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
}
});

谢谢,里亚兹

最佳答案

您应该使用当前的 Ext JS 4 API Documentation 仔细检查您的配置参数.

第一眼看到的:

  1. actionMethods是一个对象而不是字符串值配置。它在 AJAX 和 REST 代理中都实现了。如果您需要全功能的可编辑树,请考虑 REST代理人。仅当您超越 CRUD 时,您才需要向 REST 代理提供额外的actionMethods

  2. extraParams属于Proxy,不属于树配置。

因此您的商店配置应如下所示:

Ext.create('Ext.data.TreeStore', {
autoLoad: true,
proxy: {
type: 'ajax',
url: 'server.php',
extraParams: {
mode: 'getTree'
},
},
root: {
text: 'Tree',
id: 'src',
expanded: true
}
});

您是否已验证是否至少向服务器发送了一个 Ajax 请求?您可以使用 FireBug 轻松查看.

关于javascript - EXTJS4 - 对于 TreeStore,如何传递参数和操作方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6425292/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com