PDA

View Full Version : How to get all the names of the nodes of a tree



tsuryap
1 Nov 2012, 1:41 AM
Hi

i had a tree having some nodes and leafs is their way to get all the names of the tree nodes including nodes,root nodes .....

Thank you.

kevin.chen
2 Nov 2012, 2:12 PM
you can make following call



treePanel.getRootNode().cascadeBy(function() {
console.log(this.getName())
});

kevin.chen
2 Nov 2012, 2:14 PM
cacacadeBy() is a function traveling the whole tree to access each node, by default, the scope is current node you are traveling. so, you can access any property of current node by using 'this'

kevin.chen
2 Nov 2012, 2:17 PM
you also can access NodeStore by calling gridView.getMasterStore(), this store is same as grid store except each record is tree node, if you don't care the structure of the tree, then you can use it.

tsuryap
2 Nov 2012, 10:13 PM
thank you very much