1
在一次AJAX调用中,我从服务器获取了x个项目及其相关目录结构,然后从服务器断开连接。现在所有的操作都应该从浏览器中运行。jsTree open_all始终未触发
现在加载到Listbox和jsTree中的项目应该加载关联数据onChange事件。一切正常,但jsTree的open_all仅适用于第一个Listbox单击。之后它崩溃了。
这是我的代码。
function Refresh(item) {
$('#MainTree').bind("loaded.jstree", function (e, data) {
$('#MainTree').jstree("open_all"); //WORKS FINE
//data.inst.open_all(-1); //WORKS FINE
}).jstree({
"json_data": {
"data": [item]
},
"themes": {
"theme": "default",
"dots": true,
"icons": true
},
"ui": {
"select_limit": 1
},
"plugins": ["themes", "json_data", "ui", "types"]
});
}
而且下面是我的HTML按钮的代码,崩溃&开放也能正常工作。任何想法?
<input type="button" value="Collapse All" onclick="$('#MainTree').jstree('close_all');">
<input type="button" value="Expand All" onclick="$('#MainTree').jstree('open_all');">