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

3 posts, 0 answers
  1. Dave
    Dave avatar
    10 posts
    Member since:
    Nov 2015

    Posted 18 Nov 2015 Link to this post

    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. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 20 Nov 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Dave
    Dave avatar
    10 posts
    Member since:
    Nov 2015

    Posted 24 Nov 2015 in reply to Boyan Dimitrov Link to this post

    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

Back to Top