Clicking on node makes it toggle between opened and closed. Nodes needs to have id attribute for this to work.
[javascript]
.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>
[/javascript]
0 comments:
Post a Comment