How can I refresh the contents of a jsTree?

前端 未结 5 1662
心在旅途
心在旅途 2020-12-29 00:55

I have loaded a jsTree with an AJAX call that returns JSON data. How can I refresh the tree so that it reloads its contents?

5条回答
  •  误落风尘
    2020-12-29 01:17

    var tree = jQuery.jstree._reference("#files");
    tree.refresh();
    

    or

    var tree = jQuery.jstree._reference("#files");
    var currentNode = tree._get_node(null, false);
    var parentNode = tree._get_parent(currentNode);
    tree.refresh(parentNode);
    

提交回复
热议问题