5 Answers, 1 is accepted
0
Hi Joseph,
You could retrieve the dataItem of the selected node and check it's hasChildren property.
E.g.
I wish you a great day!
Regards,
Dimiter Madjarov
Telerik
You could retrieve the dataItem of the selected node and check it's hasChildren property.
E.g.
var
tv = $(
"#treeview"
).data(
"kendoTreeView"
);
var
item = tv.dataItem(tv.select());
var
hasChildren = item.hasChildren;
I wish you a great day!
Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joseph
Top achievements
Rank 2
answered on 27 Mar 2014, 12:57 PM
Hi,
Thanks for the response.
I tried the same. But unable to get the Child Nodes.
I am getting this exception "Unhandled exception at line 278, column 10 in http://localhost:47216/treeView
0x800a138f - Microsoft JScript runtime error: 'hasChildren' is null or not an object"
items are returning undefined.
Please find the attached screenshot for more information.
Help me in this.
Regards,
Satish
Thanks for the response.
I tried the same. But unable to get the Child Nodes.
I am getting this exception "Unhandled exception at line 278, column 10 in http://localhost:47216/treeView
0x800a138f - Microsoft JScript runtime error: 'hasChildren' is null or not an object"
items are returning undefined.
Please find the attached screenshot for more information.
Help me in this.
Regards,
Satish
0
Joseph
Top achievements
Rank 2
answered on 27 Mar 2014, 01:33 PM
Hi,
I found the solution. Please find the details below.
function onSelect(e) {
var tv = $("#treeview-right").data("kendoTreeView");
var selectedNode = tv.select();
var item = tv.dataItem(e.node);
var hasChildren = item.hasChildren;
}
Regards,
Satish.N
I found the solution. Please find the details below.
function onSelect(e) {
var tv = $("#treeview-right").data("kendoTreeView");
var selectedNode = tv.select();
var item = tv.dataItem(e.node);
var hasChildren = item.hasChildren;
}
Regards,
Satish.N
0
Joseph
Top achievements
Rank 2
answered on 27 Mar 2014, 04:23 PM
Hi,
Can you please help on the following:
I would like to know the node which i have selected is child node or main node.
Help me on this ASAP.
Regards,
Satish.N
Can you please help on the following:
I would like to know the node which i have selected is child node or main node.
Help me on this ASAP.
Regards,
Satish.N
0
Hello,
I am glad that you managed to fix the previous issue. To achieve the current requirement you could use the parentNode() method. It will return the parent node of the item or undefined if there is no such.
E.g.
Regards,
Dimiter Madjarov
Telerik
I am glad that you managed to fix the previous issue. To achieve the current requirement you could use the parentNode() method. It will return the parent node of the item or undefined if there is no such.
E.g.
if
(item.parentNode() === undefined) {
//it is main node
}
Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!