Jstree gets all the root child nodes

How to get all child nodes in jsTree? I need to click on the parent tree and get all its children in the array. It is preferable to iterate and assign a new associative array ... but this is for a later one.

Where data.inst.obj is any parent node with children .. I tried this: children = data.inst.obj.find ("li") .. array of 0

all_children = data.inst._get_children (data.rslt.obj); the length of this array (all_children.length) is 0.

I'm missing something obvious here, I'm sure ...

+4
source share
1 answer

The tree can be verified through the DOM without using event handler data.

An example of how to read a tree: http://jsfiddle.net/mmeah/YKqEQ/

var myTreeContainer = $.jstree._reference(myTree).get_container(); var allChildren=myTreeContainer.find("li"); 
0
source

Source: https://habr.com/ru/post/1403691/


All Articles