How can I refresh the contents of a jsTree?

限于喜欢 提交于 2019-11-29 04:24:50

问题


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?


回答1:


Turns out is is as simple as calling:

   tree.jstree("refresh");



回答2:


At version 3 you can reload the tree :

$('#treeId').jstree(true).settings.core.data = newData;
$('#treeId').jstree(true).refresh();



回答3:


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);



回答4:


for jstree3 . I use destroy() function and again create tree running jstree() function




回答5:


$('#treeId').data('jstree', false).empty().jstree(json);



来源:https://stackoverflow.com/questions/3682045/how-can-i-refresh-the-contents-of-a-jstree

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!