Quantcast

Auto expanding only certain Tree nodes

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Auto expanding only certain Tree nodes

Harry Devine
I'm redesigning one of my applications, and I'm adding a dijit/Tree.  In
that tree, I want 2 or 3 nodes to be automatically expanded, and the
others collapsed.  I can only see how to expand or collapse all nodes at
startup via the autoExpand flag.  Does anyone know how I can achieve this?

Thanks,

Harry

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Auto expanding only certain Tree nodes

George Sexton



On 3/27/2017 4:58 PM, Harry Devine wrote:
I'm redesigning one of my applications, and I'm adding a dijit/Tree.  In 
that tree, I want 2 or 3 nodes to be automatically expanded, and the 
others collapsed.  I can only see how to expand or collapse all nodes at 
startup via the autoExpand flag.  Does anyone know how I can achieve this?

I looked through the docs, and couldn't make headway either. Given my recent experiences, what I would do is add an onLoad() handler, and set a break-point in it. Once the break-point triggers, I'd start exploring things using the browser's debugger. In particular, I would look at:

domNode
model
selectedItems
getChildren()

Unfortunately, if you can't find it in the docs, archeology is about your only option. Once you can get a reference to a node, then you can start exploring it for event handlers and methods.



Thanks,

Harry


--
George S.
MH Software, Inc.
Voice: 303 438 9585
http://www.connectdaily.com

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Auto expanding only certain Tree nodes

Harry Devine

What I ended up doing last night, after doing some searching, was using the Dijit Tree's "path" property.  I gave it the path of the node I wanted to expand and it opened that node at run time.  Worked really well.


Thanks for the help!

Harry

On March 28, 2017 at 1:26 PM "George S." <[hidden email]> wrote:



On 3/27/2017 4:58 PM, Harry Devine wrote:
I'm redesigning one of my applications, and I'm adding a dijit/Tree.  In 
that tree, I want 2 or 3 nodes to be automatically expanded, and the 
others collapsed.  I can only see how to expand or collapse all nodes at 
startup via the autoExpand flag.  Does anyone know how I can achieve this?

I looked through the docs, and couldn't make headway either. Given my recent experiences, what I would do is add an onLoad() handler, and set a break-point in it. Once the break-point triggers, I'd start exploring things using the browser's debugger. In particular, I would look at:

domNode
model
selectedItems
getChildren()

Unfortunately, if you can't find it in the docs, archeology is about your only option. Once you can get a reference to a node, then you can start exploring it for event handlers and methods.


Thanks,

Harry


--
George S.
MH Software, Inc.
Voice: 303 438 9585
http://www.connectdaily.com


 

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Auto expanding only certain Tree nodes

neekfenwick
On 30/03/17 02:30, Harry Devine wrote:
>
> What I ended up doing last night, after doing some searching, was
> using the Dijit Tree's "path" property.  I gave it the path of the
> node I wanted to expand and it opened that node at run time.  Worked
> really well.
>

FYI there is
https://dojotoolkit.org/reference-guide/1.10/dijit/Tree-examples.html#expanding-and-selecting-tree-nodes-programmatically 
which mentions this.

Many moons ago I wrote content there that recursively iterated a store
to build the path of id's you need, but I seem to recall it was based on
the old dojo.data.ItemFileReadStore (and was probably not very good
quality code) and it looks like someone has removed it since dojo/store
took over.

Nick
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...