Racheli Amrusi
Racheli Amrusi

Reputation: 35

JsTree How to load_all node on refresh

i am implement Jstee in my project , When the tree loade , i am invoke the function load_all that load all tha node in the beginning and not when clicking on button , i want to create button that refresh the tree again !! and "load_all" again in refresh!!

 tree.bind("loaded.jstree", function (event, data) 
 {
      tree.jstree("load_all");
 });

 $( "#refreshTree" ).on( "click", function(event)
  {
          event.preventDefault();
          tree.trigger("loaded.jstree");
          tree.jstree("refresh");
  });

this code is not success , it is just refresh my node but not load all node again !!

Upvotes: 0

Views: 2991

Answers (1)

Racheli Amrusi
Racheli Amrusi

Reputation: 35

The solution I found was to add a binding to refresh.jstree that will trigger load_all on the tree.

 tree.bind("refresh.jstree", function (event, data) 
 {
     tree.jstree("load_all");
 });

and my click handler looks like:

 $( "#refreshTree" ).on( "click", function(event)
 {
    event.preventDefault();
    tree.jstree("refresh");  
 });

Upvotes: 4

Related Questions