[Dojo-interest] Expanding dijit Tree

Sudha Srinivasan sudhas at sgi.com
Thu Aug 25 10:45:10 EDT 2011


I have not looked at the example, but I use an expandAll function that 
takes the tree id as param and it works for me:

function expandAll(treeId) {
         var tree = dijit.byId(treeId);
         nodes = tree.rootNode.getChildren();
         var node;
         for (var i = 0; i < nodes.length; i++){
                 node = nodes[i];
                 if (node.isExpandable) {
                         tree._expandNode(node);
                         expandAll(null, treeId, node.getChildren());
                 }
         }
}

-Sudha

On 8/25/2011 3:07 PM, vinsar12 wrote:
> Hi Bill,
>
> I got the code for expandAll() but it doesn't seem to work :(
>
> *Here is my code:*
>
> <div dojoType="dijit.tree.ForestStoreModel" jsId="TreeModel"
> store="prTreeDataStore" query="{type: 'parentHead'}">
> </div>
> <div dojoType="dijit.Tree" id="prTree" model="TreeModel" labelAttr="name"
> showRoot="false" label="XXX"  openOnClick="true" style="min-height: 250px;
> height: 250px; overflow:auto;"></div>
> </div>		
>
> I want to expand the 'prTree' before printing..
> Please help..
> Thanks.
>
> --
> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Expanding-dijit-Tree-tp3277305p3283468.html
> Sent from the Dojo Toolkit mailing list archive at Nabble.com.
> ________________________________________________________
> Dojotoolkit: http://dojotoolkit.org
> Reference Guide: http://dojotoolkit.org/reference-guide
> API Documentation: http://dojotoolkit.org/api
> Tutorials: http://dojotoolkit.org/documentation
>
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest



More information about the Dojo-interest mailing list