Reputation: 2480
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 :)
Upvotes: 0
Views: 3267
Reputation: 8976
Stated in Ext doc, the Ext.dataNodeInterface.remove
:
Removes this node from its parent
Root node has no parent, so remove
won't work. However, to remove the whole tree from treepanel, you can try:
treepanel.setRootNode(null);
I have created a plunk to demonstrate a few examples you might be interested in.
Upvotes: 1