This is a migrated thread and some comments may be shown as answers.

Expand subnode via code

2 Answers 52 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Ruud
Top achievements
Rank 1
Ruud asked on 04 Jul 2015, 02:53 PM

Hi,

I try to use this tree list; i need to expand a complete parent-multiple children in the tree. So:

- child deep in the hierarchy is known to my code and can be found in the tree list

- via code, the complete tree needs to be expanded to expand the child itself and all its parents

The demos only seem to work programmatically expanding nodes which are already displayed, but in this case the child nodes can be hidden. Is there a way to do this? Thanks in advance!

Best regards,

Ruud

2 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 08 Jul 2015, 06:07 AM

Hello Ruud,

You can find the child node by id via the DataSource get method. Then, loop through all its parents (getting them via the parentNode method) and set their expanded state to true (node.set("expanded", true)).

For a working sample, see this Dojo snippet.

Regards,
Alex Gyoshev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ruud
Top achievements
Rank 1
answered on 08 Jul 2015, 08:36 AM

Hi Alex,

Thanks! So easy lol.. I guess i was a bit confused by the code used for doing the treelist.select(), where you have to put in a jQuery selector. I assumed the expand command also would need jQuery selectors; never thought of the treelist datasource object to accomplish this.  Rtfm it is:(..

Regards,

Ruud

Tags
TreeList
Asked by
Ruud
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Ruud
Top achievements
Rank 1
Share this question
or