Return to Snippet

Revision: 53009
at November 15, 2011 19:25 by vtoman


Updated Code
.bind("select_node.jstree", function (event, data) {
    var id = data.rslt.obj.attr("id");
    if (id != undefined) {
        if ($("li[id=" + id + "]").hasClass("jstree-open"))
            $("#treeViewContainer").jstree("close_node", "#" + id);
        else
            $("#treeViewContainer").jstree("open_node", "#" + id);
    }
}

<div id="treeViewContainer">
    <ul>
       
    </ul>
</div>

Revision: 53008
at November 10, 2011 01:51 by vtoman


Initial Code
$("#treeViewContainer").jstree("open_node", "#" + id);

<div id="treeViewContainer">
    <ul>
       
    </ul>
</div>

Initial URL

                                

Initial Description
Clicking on node makes it toggle between opened and closed. Nodes needs to have id attribute for this to work.

Initial Title
Opening / closing jstree node

Initial Tags

                                

Initial Language
jQuery