Hi,
This is the code you need:
$("#tree1").bind("open_node.jstree", function (event, data) {
data.rslt.obj.siblings(".jstree-open").each(function ()
{ data.inst.close_node(this, true); });
});
This will work on all levels, to make it work only for root nodes:
$("#tree1").bind("open_node.jstree", function (event, data) {
if(data.inst._get_parent(data.rslt.obj) == -1) {
data.rslt.obj.siblings(".jstree-open").each(function ()
{ data.inst.close_node(this, true); });
}
});
Kindest regards,
Ivan