[Dojo-interest] Expanding dijit Tree

Bill Keese bill at dojotoolkit.org
Fri Aug 26 02:22:01 EDT 2011


BTW, the code below will work fine but only if the tree is hooked up to a
synchronous store.    If the store is async the getChildren() call will fail
because the children won't be available yet.

On Thu, Aug 25, 2011 at 11:45 PM, Sudha Srinivasan <sudhas at sgi.com> wrote:

> 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
>
> ________________________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20110826/bd6ee207/attachment.htm 


More information about the Dojo-interest mailing list