小编Moe*_*Moe的帖子

重新加载jstree而不刷新页面

我正在尝试重新加载jstree而不重新加载或刷新页面,重新加载应该发生onclick在按钮上,因此当单击按钮时我会调用

$("#tree-container").jstree('destroy'); 
//then calling the function that reads or renders the tree
Run Code Online (Sandbox Code Playgroud)

当没有渲染树时,效果很好,但是当已经渲染树并且我单击按钮时,我得到:“无法调用未定义的方法 init”。错误发生在jstree plugin.

我什至尝试删除容器,然后在调用读取树的函数之前将其重新附加到其父容器中

$("#tree-container").remove();

$('#parent-tree-container').append($('<div id="tree-container"></div>'));
//then called the function that reads/renders the tree  
Run Code Online (Sandbox Code Playgroud)

但这仍然不起作用。:(

提前致谢。

jstree

3
推荐指数
1
解决办法
8642
查看次数

标签 统计

jstree ×1