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

How to expand/collapse all child nodes of a selected row

2 Answers 862 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 18 Nov 2015, 08:20 PM

Hello,

I have a TreeList where I would like to select a row, click an image button, and have all the child rows expand (or collapse), with all of their child rows expanding, and all of their child rows expanding, until all rows have been fully expanded (or collapsed).

So if I have this:

selectedRow = treeList.content.find(".k-state-selected");

from the selectedRow, I want all child rows and their child rows, and all their child rows, etc... to expand until all rows have expanded fully.

I also would like to click a separate collapse button where all child rows of my selectedRow will collapse up from the bottom child rows, one row at a time until the selectedRow is finally collapsed.

I have the image buttons and am calling some functions that will expand or collapse just 1 level from the selectedRow.  I have looked through various examples in your documentation but have not been able to fully implement this functionality.

Could you please provide a code snippet if possible on how this can be done starting with: selectedRow = treeList.content.find(".k-state-selected");

Thank you ...

Dave

2 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 20 Nov 2015, 12:54 PM

Hello Dave,

 

My suggestion is to use the expand method of the Kendo UI TreeList widget. A possible solution to find all children is to iterate through the data of the TreeListDataSource and find all models with specific parent id. Please refer to the kendo ui treelist - get all children forum discussion. 

 

Once you have the model object you can get its uid value and find the table row with the same data-uid attribute. 

 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Dave
Top achievements
Rank 1
answered on 24 Nov 2015, 01:44 PM

Hello Boyan,

Thank you for the reply. I was able to use the information you gave me to achieve what I needed to do.  Thanks again...

Dave

Tags
TreeList
Asked by
Dave
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Dave
Top achievements
Rank 1
Share this question
or