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

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

7 Answers 1056 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kannan
Top achievements
Rank 1
Kannan asked on 11 Oct 2018, 01:31 AM
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.

7 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 12 Oct 2018, 02:14 PM
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.
0
Kannan
Top achievements
Rank 1
answered on 22 Oct 2018, 11:44 PM

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.

0
Vessy
Telerik team
answered on 24 Oct 2018, 03:55 PM
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.
0
Kannan
Top achievements
Rank 1
answered on 25 Oct 2018, 02:24 PM
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 ?
0
Accepted
Vessy
Telerik team
answered on 26 Oct 2018, 08:46 AM
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.
0
Kannan
Top achievements
Rank 1
answered on 30 Oct 2018, 12:01 AM
Hi Vessy, Thank you so much for your valid response.
0
Vessy
Telerik team
answered on 30 Oct 2018, 01:29 PM
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.
Tags
TreeView
Asked by
Kannan
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Kannan
Top achievements
Rank 1
Share this question
or