0

I have a tree panel with local data like

 root: {
            text: 'root',
            children: [
                { text: "child"
                  leaf: true
                }]
 ....
}

first: I want to delete root of tree. I try below code but that not working for root. However that work for another node (node.remove(true))

tree.getRootNode().remove(true);

second: I want to remove all tree (i think this like remove root?)
How can i do that thanks :)

4

1 回答 1

1

Ext doc中声明,Ext.dataNodeInterface.remove

从其父节点中删除此节点

根节点没有父节点,所以remove不会工作。但是,要从树形面板中删除整棵树,您可以尝试:

treepanel.setRootNode(null);

我创建了一个plunk来演示一些您可能感兴趣的示例。

于 2013-07-10T17:56:09.857 回答