Clicking node collapse all other nodes

563 views
Skip to first unread message

Mojojo

unread,
Sep 6, 2010, 6:10:44 AM9/6/10
to jsTree
Hello.

I want to make it so that only one node is expanded at all times.
example:

When a node is expanded, showing all children I want in to collapse
after another node is opened.

BTW: Great plugin you have created.

vakata

unread,
Sep 17, 2010, 8:57:45 AM9/17/10
to jsTree
You can achieve that using the open_node event - listen for it, and
when it occurs close all other nodes on the same level.
$("#container").bind("open_node.jstree", function (e, data) {
data.rslt.obj.siblings().filter(".jstree-open").each(function () {
data.inst.close_node(this);
});
});

You can also disable the animations if you will.

Kindest regards,
Ivan
Reply all
Reply to author
Forward
0 new messages