ExtJS TreeLoader 问题

发布于 2024-09-26 06:33:53 字数 289 浏览 0 评论 0原文

我对 ExtJS 不太熟悉,但正在开发一个使用它的项目。

我们使用带有 TreeLoader 的 TreePanel,在一次调用中从服务器加载所有节点数据。我们有一个事件,我需要访问树中每个节点的属性。我这样做的方法是使用 TreePanel 的 getNodeById 方法。问题是树面板似乎延迟加载节点,并且无法使用 getNodeById 检索节点,除非该节点已经加载。

有没有办法强制加载所有节点?我最接近的是使用 TreeLoader 上的 preloadChildren 属性,但这仍然仅在加载包含子节点的父节点时加载。

I'm not too familiar with ExtJS, but am working on a project that uses it.

We are making use of a TreePanel with a TreeLoader that loads all node data from the server in one call. We have an event in which I need to access the attributes of every node in the tree. The way I am doing this is using the TreePanel's getNodeById method. The problem is that the tree panel seems to lazily load nodes and will not be able to retrieve a node with getNodeById unless the node has already been loaded.

Is there any way to force all nodes to be loaded? The closest I've come is by using the preloadChildren attribute on the TreeLoader, but this still only loads when the parent node containing children is loaded.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

朮生 2024-10-03 06:33:53

如果您希望能够访问所有节点,则必须在第一次调用时加载完整的树结构。

第一次调用的 JSON 响应应包含所有树节点。例如:

[{
    id: 1,
    text: 'A leaf Node',
    leaf: true
},{
    id: 2,
    text: 'A folder Node',
    children: [{
        id: 3,
        text: 'A child Node',
        leaf: true
    }]

}]

If you want to be able to access all the nodes, you must load the complete tree structure on the first call.

The JSON response on the first call should include all the tree nodes. For example:

[{
    id: 1,
    text: 'A leaf Node',
    leaf: true
},{
    id: 2,
    text: 'A folder Node',
    children: [{
        id: 3,
        text: 'A child Node',
        leaf: true
    }]

}]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文