Login Register

How can i create a dijit.Tree and without expanding the root at beginning?

[editor: moving to the appropriate forum…]

Hi everyOne,
i'm new here, i try to create a dijit.Tree with the ForestStoreModel, but after loading the tree, the nodes of first level have already expanded, are there any function to close the root after loading the tree? thanks!

Yes, there is a function to collapse tree nodes

Every tree node has collapse() and expand() functions.

So for a tree with id "myTree" you can do

dijit.byId("myTree").rootNode.collapse();

thank you very much josh_b,

thank you very much josh_b, another question, are there any parameters(maybe collapse:tree :P ) to ctrl the rootnode when we create a new tree?