I'm trying to get the selected item with a specific id from outside of the kendo treeview. Basically, I'm writing a js function to try to find out which node is selected. Is there a way to find out which node (and it's datasource properties) can be extracted?
I can get the node data if the an event listener passes the event but can't figure out a way to get to that node without the event listener.
Once I get that data, I would like to update some button links to go to the next item in the node.
//get node WITH listener:
function getNode(e){
var nodedata = $('#treeName').getKendoTreeView().dataItem(e.node).id;
console.log(nodedata);
}
//BUT I want to find out from outside of Kendo treeview with something like this:
function getNode() {
var getSelectedId = $('#treeName').getKendoTreeView().getCurrentSelectedItem().id
console.log(getSelectedId);
}
It's pretty straightforward. Just use
$('#treeName').data("kendoTreeView").select().data().id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With