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

Expand node with single click

2 Answers 287 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 04 Sep 2018, 06:06 PM

Hi, 

I need the selected node to expand on single click if the node has children.  I tried using the toggle() method on the selected node during the dropdowntree change event but have been unable to produce the desired result.

For your health,

Chad

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetomir
Telerik team
answered on 06 Sep 2018, 03:41 PM
Hi Chad,

You can access the TreeView of the DropDownTree and use the events and methods it provides. More information on how to access it you can find here: treeview. After accessing the treeview, you can add the expand event. In the event handler check if the node is expanded, if not call the expand() method to the closest node that is not expanded. You can find more insight on the method here: expand() method.

Another possible approach would be to use the expandTo() method and as an input argument pass the node until which you would like to expand. 

I also created a sample Dojo project to demonstrate how the aforementioned suggestions could be implemented:
http://dojo.telerik.com/EQIYEViT

Please give it a try and see if it works as expected on your side as well.

Kind regards,
Tsvetomir
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
Chad
Top achievements
Rank 1
answered on 06 Sep 2018, 06:35 PM

Thanks Tsvetomir,

This lead me to the answer I was looking for.  treeview.expand(treeview.findByText("foo")); did the trick for me

Tags
DropDownTree
Asked by
Chad
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Chad
Top achievements
Rank 1
Share this question
or