I would like to achieve a functionality where in when I try to collapse the tree , all other level except the first level nodes are closed.
ie
<item text="A=“a”>
<item text="A1=“a1”>
<item text="A2=“a2”>
<item text="A3=“a3”>
<item text="B=“b”>
<item text="B1=“b1”>
<item text="B2=“b2”>
<item text="B3=“b3”>
<item text="C=“c”>
<item text="C1=“c1”>
<item text="C2=“c2”>
<item text="C3=“c3”>
<item text="D=“d”>
<item text="D1=“d1”>
<item text="D2=“d2”>
<item text="D3=“d3”>
So when I do a collapse all I want my tree to look like
<item text="A=“a”>
<item text="B=“b”>
<item text="C=“c”>
<item text="D=“d”>
How can I achieve this… when I do closeAllItems() it closes all the nodes.
Thanks
There is no built in solution, but you can use onOpenStart event to set any custom reaction on item opening|closing
In case of two-level tree, next code will work
tree.attachEvent(“onOpenStart”,function(id,state){
if (state==-1){
if (this._last_open)
tree.closeItem(this._last_open);
this._last_open=id;
}
return true;
});