Search code examples
jqueryjquery-eventsjstreeevent-binding

jsTree does not retain node selection after Refresh Event


The jsTree when refreshed does not retain the previous selected Node. When the jsTree is opened and a node is the selected, then on refresh, the jsTree is closed. This is the jsFiddle Example

I had tried with event binding but does not seem to work. Please let me know of a work around.

JS:

$(function () {
    $('#jstree').jstree();
});

function refresh(){
   $("#jstree").jstree("refresh");
}

Solution

  • I have edit your fiddle. Ist this what you want??

    Fiddle

    $(function () {
    $('#jstree').jstree({plugins: ["state"]});
    });
    
    
    function refresh(){
    $("#jstree").jstree("refresh");
    }