How to perform 'Expand' and 'Collapse' in Kendo Tree View on click of Expand button and Collapse button

8 posts, 1 answers
  1. Kannan
    Kannan avatar
    8 posts
    Member since:
    Jul 2018

    Posted 10 Oct 2018 Link to this post

    Dear Team,

    I am new to Kendo control, please help me with this, I already have Tree View as shown in the attachment, Now I have two(Expand  and Collapse) buttons, I need to perform the  'Expand All'  on click of Expand button and 'Collapse All'  on click of  Collapse button.

    How to perform 'Expand All' and 'Collapse All' in Kendo Tree View on click of Expand button and Collapse button.

    Please help me on this.
  2. Vessy
    Admin
    Vessy avatar
    2300 posts

    Posted 12 Oct 2018 Link to this post

    Hi Kannan,

    I have just answered your other thread on the matter, please, refer my answer there:
    https://www.telerik.com/forums/how-to-perform-'expand-all'-and-'collapse-all'-in-kendo-tree-view-on-click-of-expand-button-and-collapse-button

    Regards,
    Vessy
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Kannan
    Kannan avatar
    8 posts
    Member since:
    Jul 2018

    Posted 22 Oct 2018 in reply to Vessy Link to this post

    Hi Veddy, Thanks for your response, I am sorry for the late response, as My machine was crashed , hence it tooj more time to response.

    using  your code , it Expands only 1 level down to child, but I need to expand all the childs below to the each parents. Please help me, How can be done using Kendo UI Jquery, Its urgent, Please help me.

    Kindly refer the attachment, which has the tree structure.

  4. Vessy
    Admin
    Vessy avatar
    2300 posts

    Posted 24 Oct 2018 Link to this post

    Hi Kannan,

    The nested nodes of the TreeView are not bound in the moment when the expand() method is called, this is why only the first level nodes are expanded. A possible approach you can implement is to check whether there are ".k-item .k-i-expand" items (nodes with expand icon) and call the expand() method recursively if there are such.

    For example: https://dojo.telerik.com/UVoHemup/2


    Regards,
    Vessy
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Kannan
    Kannan avatar
    8 posts
    Member since:
    Jul 2018

    Posted 25 Oct 2018 in reply to Vessy Link to this post

    Hi Vessy, Good morning, Thanks  again for your response, is it possible to achieve this without using recursion method.  I already used similar logic which you have explained, due to recursion its taking more time to expand the tree for big hierarchy level. so I am facing performance issue.

    Is there any better way to do this in Jquery ?
  6. Answer
    Vessy
    Admin
    Vessy avatar
    2300 posts

    Posted 26 Oct 2018 Link to this post

    Hi Kannan,

    The optimal approach I can suggest you in order to expand the nodes without recursion is to expand the nodes asynchronously like demonstrated here:
    https://docs.telerik.com/kendo-ui/controls/navigation/treeview/how-to/nodes/node-async-expand

    On a side note, we are currently working on the optimization of the Treeview performance while expanding the nodes, so I will advise that you keep an eye to our release notes for such an update.

    Regards,
    Vessy
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Kannan
    Kannan avatar
    8 posts
    Member since:
    Jul 2018

    Posted 29 Oct 2018 Link to this post

    Hi Vessy, Thank you so much for your valid response.
  8. Vessy
    Admin
    Vessy avatar
    2300 posts

    Posted 30 Oct 2018 Link to this post

    Hi,

    You are welcome, Kannan - I am glad my response was helpful for you :)

    Regards,
    Vessy
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top