gpt4 book ai didi

ExtJS:如何拥有具有多个根的 TreePanel?

转载 作者:行者123 更新时间:2023-12-02 05:39:36 25 4
gpt4 key购买 nike

我正在使用 ExtJS 2.2.1

在我的网络应用程序中,我曾经有一个只有一个根的 TreePanel,如下所示:

`
|- Colors
|- Blue
|- Red
|- Yellow

现在我已经意识到顶级节点没有意义,我想删除它并提升它的子节点:

`
|- Blue
|- Red
|- Yellow

问题是,根据文档,a TreePanel must always have a single root .

如何制作具有多个节点的 TreePanel?

这是我当前创建树的代码:

var tree = new Ext.tree.TreePanel({
animate:true,
enableDD:false,
loader: new Ext.tree.TreeLoader({
dataUrl: 'colors.json'
}),
lines: true,
selModel: new Ext.tree.MultiSelectionModel(),
containerScroll: true,
autoScroll: true,
height: 100,
width: 280,
rootVisible: true,

root: new Ext.tree.AsyncTreeNode({
text: 'Colors',
hasChildren:true,
id: 1
}),
el: 'tree'
});

最佳答案

创建一个假的根节点并将 rootVisible 设置为 false 以隐藏它。

关于ExtJS:如何拥有具有多个根的 TreePanel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1099592/

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