Take the 2-minute tour ×

I'm trying to open jstree nodes in a for loop, my current approach is this:

$('#MainTree').bind("loaded.jstree", function (event, data) {
    var tree = jQuery.jstree._reference("#MainTree");
    var nodes = ["node0", "node1", "node2"];

        tree.open_node($("#" + nodes[i]), null, true);

But only the first node opens, I guess its because the second node isnt loaded at this time. I could use a callback and open the second node in that, but what about the third, fourth and so on.

I'm currently stuck here. Is there a way to use a recursive callback, something like that?

share|improve this question
add comment


Your Answer



Browse other questions tagged or ask your own question.