jquery - Can I use cookies to run code after the jsTree tree loads and its status is restored? -


how can run block of code in jstree after tree has finished loading and has been restored previous state? (i’m using cookie plugin.)

well, seems got functional work-around...

by binding the select_node event , not open_node event, can perform operation after final node opened; because selected node (before browser refresh) becomes selected after tree reloaded.

here binding code. try out , see mean:

    .bind("open_node.jstree", function(e, data){         console.log('tree opened node ' + data.rslt.obj.attr("url"));          var selectednode = $('#tree').jstree("get_selected");          if(selectednode != null)         {             console.log(selectednode.attr('id'));         }     })     .bind("select_node.jstree", function (e, data) {         var = $.jstree._focused().get_selected();          console.log('tree selected node ' + data.rslt.obj.attr("url"));          var selectednode = $('#tree').jstree("get_selected");          if(selectednode != null)         {             console.log(selectednode.attr('id'));         }     }) 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -