[Dojo-interest] Cannot collapse dijit.Tree with addOnLoad()

Jette Derriche jni at nerdgirl.dk
Thu Aug 28 16:37:42 UTC 2008

On Thu, 2008-08-28 at 09:43 -0500, Karl Tiedt wrote:
> Here is how you can expand all nodes...
>         <script type="dojo/method" event="expandChildren" args="node">
>             if(!node){
>                 var node = this;
>             }
>             if(node.getChildren().length>0){
>                 dojo.forEach(node.getChildren(), function(c){
>                     this._expandNode(c);
>                     this.expandChildren(c);
>                 }, this);
>             }
>         </script>
> This is used inside the <div dojoType="dijit.Tree"> node... and for
> newer Dojo releases replace var node = this; with var node =
> this.rootNode;

What I want is just to collapse (not expand) the rootNode... all I
really need is:


I know that part... What I don't know is _when_ to call it, since I have
no way of knowing when the rootNode is available.

> once your tree is loaded, call this.expandChildren() on it...

That's exactly my problem... I don't know when it's loaded... And to my
knowledge, the dijit.Tree does not have method for getting that

The guy I quoted said:

"There is no onSetChildren, no onCreateNode, no some other event which
occurs when the tree data is available."

Is that true? 


More information about the Dojo-interest mailing list