Reputation: 41
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.
Upvotes: 4
Views: 11275
Reputation: 663
This is how you can check whether a node has children or not.
var tree = jQuery.jstree._reference('#warehouseTree');
var isParent = instance.is_parent(selected);
console.log(isParent) // true for directory
Upvotes: 0
Reputation: 2104
This is simply how you extract children information from a specific node.
$("#tree_2").jstree().get_node("13").children
Upvotes: 5
Reputation: 1577
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.
Upvotes: 2