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

Getting html element id in treeview

1 Answer 395 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 28 Feb 2013, 08:51 AM
I have a nested <ul> in HTML that I'm converting to a treeview (using $("#myTreeView").kendoTreeView();).Every <ul> tag and <li> tag in the list have an id attribute.

Question: When a node in the tree is selected, how do I get the corresponding id of the html list element? I am able to capture the select event (using treeView.bind("select", function (e) {....})) but I dont understand how to get to the id. Constructing the tree using a datasource is probably not a feasible option for my case...

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 01 Mar 2013, 01:05 PM
Hello Gaurav,

The e.node event argument, which is mentioned in the documentation, contains a reference to the selected item's DOM element, so you can retrieve the ID from it.

http://docs.kendoui.com/api/web/treeview
(bottom of page)

TreeView events online demo:

http://demos.kendoui.com/web/treeview/events.html

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or