Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check whether selected node is having child nodes or not in jstree?

Tags:

jquery

jstree

I m taking selected node by following code.

var selected=$("#warehouseTree").jstree('get_selected');

and now i want to check for child nodes for selected node.

like image 425
Jyoti Avatar asked Feb 24 '23 15:02

Jyoti


2 Answers

This is simply how you extract children information from a specific node.

$("#tree_2").jstree().get_node("13").children
like image 115
Khateeb321 Avatar answered Feb 26 '23 04:02

Khateeb321


Try this:

var tree = jQuery.jstree._reference('#warehouseTree');
var children = tree._get_children(selected);

Which will return an array of jQuery objects of the children of the selected node.

like image 33
Dan Brooke Avatar answered Feb 26 '23 04:02

Dan Brooke