Collapse all nodes except selected when using plus/minus

Hi,

I have managed to collapse all other nodes when selecting the node text by attaching to the onClick event, but can not get it to work when clicking the plus/minus.

any help is greatly appreciated.

Thanks,

Orion

Can suggest you to try such solution:

var selected, tree; tree.loadXML("tree.xml", function(){tree.openItem('books')}); tree.attachEvent("onClick", function(){ selected = tree.getSelectedItemId(); }); tree.attachEvent("onOpenStart", function(id,state){ //debugger; if (id == 'books' && state == 1){ tree.closeAllItems(id); tree.openItem(selected); return false; } return true; });