For those who already work with JQuery Tree plugin, maybe you need to open only one branch at time, closing others. Here is how I resolved this problem :
$('#tree').tree({
callback: {
onOpen: function(NODE, TREE_OBJ) {
// fermeture des branches suivantes
closeNextBranches(TREE_OBJ.next(NODE, true), TREE_OBJ);
// fermeture des branches précédentes
closePrevBranches(TREE_OBJ.prev(NODE, true), TREE_OBJ);
}
}
});
function closeNextBranches(NODE, TREE_OBJ) {
TREE_OBJ.close_branch.call(TREE_OBJ, NODE);
if (TREE_OBJ.next(NODE, true) != false) {
closeNextBranches(TREE_OBJ.next(NODE, true), TREE_OBJ);
}
}
function closePrevBranches(NODE, TREE_OBJ) {
TREE_OBJ.close_branch.call(TREE_OBJ, NODE);
if (TREE_OBJ.prev(NODE, true) != false) {
closePrevBranches(TREE_OBJ.prev(NODE, true), TREE_OBJ);
}
}
I hope this piece of code will help you. Don't hesitate to give me other solutions.