kendo treeview get selected node data

Solutions on MaxInterview for kendo treeview get selected node data by the best coders in the world

showing results for - "kendo treeview get selected node data"
Julia
05 Oct 2019
1// First to which ever element you specified your treeview with its datasource
2// Create a new variable of it:
3
4var tv = $('.mytree').data('kendoTreeView');
5
6// You can get the node that you select by calling select() on your treeview
7var selected = tv.select();
8
9// Then use your selected as a parameter in the dataItem() function.
10var item = tv.dataItem(selected);
11
12// Then you can see what kind of data is inside it by e.g.
13console.log(item); // and opening the inspector and expanding your item object
14
15// Or
16alert(JSON.stringify(item));
17
18// The object you specified in the data source will be shown with other useful variables.
19
20// To see how to use the data source with json check http://jsfiddle.net/NZq4A/2/