0

I am trying to get all the nodes with their levels, I mean that when the tree is completely loaded I want to get the node's levels of all of them.

I tried to do this:

var idList = [];
var jsonNodes = $('#albero').jstree(true).get_json('#', { flat: true });
$.each(jsonNodes, function (i, val) {
    idList.push($(val).attr('id'));
});

But it gives me the level of the selected node, not all of them. My Tree looks like this:

enter image description here

  • Possible duplicate of [jsTree : How to get all nodes from jstree?](https://stackoverflow.com/questions/10296410/jstree-how-to-get-all-nodes-from-jstree) – Vinay Oct 23 '17 at 17:10
  • I checked that question and the answers but it does not work in my case. I mean it selects the nodes but only if I select them one by one, not after the tree is loaded. – Daniel Bachmatchi Oct 24 '17 at 06:58

0 Answers0