How do I open all nodes in jquery Jstree?

前端 未结 9 1753
感情败类
感情败类 2021-02-05 00:07

I am using the following code:

$("#treeview").jstree();
$("#treeview").jstree(\'open_all\');

With the following html:

9条回答
  •  孤城傲影
    2021-02-05 00:48

    If you want open all node when tree loaded:

    $("#treeview")
        // call `.jstree` with the options object
        .jstree({
            "plugins" : ["themes", "html_data","ui","crrm","sort"]
        }) 
        .bind("loaded.jstree", function (event, data) {
            // you get two params - event & data - check the core docs for a detailed description
            $(this).jstree("open_all");
        })      
    });
    

提交回复
热议问题