Reputation: 10254
Hello Im using a for loop to open all nodes.
Is there a way to just to open all nodes at once instead of a loop??
function (event, data) {
var myChilds=myfavTree.find("li");
for(var i=0;i<myChilds.length;i++){
var myId= $(myChilds[i]).attr("id");
$("#dataTree").jstree("open_node","#"+myId);
}
Upvotes: 0
Views: 1642
Reputation: 6770
$("#dataTree").jstree('open_all');
Depending on when and how you are trying to do this you may also want to refer to this fairly similar question: How do i open all nodes in jquery Jstree?
Update based on clarification: If the loop itself is your problem you could try a more specific selector and see if that handles your problem. An id attribute selector should find only the li items with ids. That way your selector engine should be doing the heavy lifting and you can call
var myChilds = myFavTree.find("li[id]")
myChilds.each(function(){
$("#dataTree").jstree("open_node",this.id)
})
Upvotes: 1