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

Select event - Multiple trees

2 Answers 34 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Justin Lee
Top achievements
Rank 1
Justin Lee asked on 28 Dec 2016, 04:36 PM

.asp.net - mvc

I have a page that has multiple treeviews. (created dynamically)

I have added a function for the "Select" event of the trees.  In the function, I want to get the Id of the selected node.  From what I've read, this is done by: $("#treename").data("kendoTreeView").dataItem(e.node).id

However, because the method is wired to multiple trees, I do not know what tree e.node is in. (I do not know what #treename is)

How can I obtain information about the selected node in the Select event?

 

Thanks,

Justin

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Tsvetanov
Telerik team
answered on 30 Dec 2016, 07:59 AM
Hello Justin,

As far as I can understand, you have the same Select event handler for multiple TreeViews. In this case, you could access the TreeView, that fires the event from the event argument object:
function onSelectNode(e) {
    var treeView = e.sender;
}

Here you will find a simple implementation of the discussed.

Regards,
Veselin Tsvetanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Justin Lee
Top achievements
Rank 1
answered on 30 Dec 2016, 03:15 PM
Thanks Veselin.
Tags
TreeView
Asked by
Justin Lee
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Justin Lee
Top achievements
Rank 1
Share this question
or