jsTree open_all一直没有开火

时间:2011-06-16 23:34:06

标签: jquery json jstree

我在一次AJAX调用中从服务器获取x个项目及其相关的目录结构,然后它与服务器断开连接。现在所有操作都应该在浏览器中运行。

现在,在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');">

1 个答案:

答案 0 :(得分:0)

经过几天的尝试,我放弃了这个并尝试了TreeTable插件,它运行得很完美。

希望这有助于某人。

相关问题