PDA

View Full Version : can not get the treenode before the tree is expaned?



atreeyang
14 Sep 2009, 12:38 AM
I use a json array data to construct the tree.
seems when the tree is not expand, the treepanel.getNodeById() failed by undefined error.
But after rootNode.expand(), I can get the node by treepanel.getNodeById().
In the fact, I want to load the tree, and then check the leaf and only expand the path from the root to the leaf.

I do not want to expand all the nodes.

makana
14 Sep 2009, 4:34 AM
The TreeNode ids are not available until the nodes are loaded, because the nodes aren't available themselves.
I had the same problem some time ago and build a solution:
http://www.extjs.com/forum/showthread.php?p=240931#post240931

You can also check this alternative from murrah:
http://www.extjs.com/forum/showthread.php?t=68381