Categories | Question details Back To List | ||
Tree Collapsed with all parent nodes shown. 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 <tree id="0"> <item text="A="a"> <item text="A1="a1"> <item text="A2="a2"> <item text="A3="a3"> </item> <item text="B="b"> <item text="B1="b1"> <item text="B2="b2"> <item text="B3="b3"> </item> <item text="C="c"> <item text="C1="c1"> <item text="C2="c2"> <item text="C3="c3"> </item> <item text="D="d"> <item text="D1="d1"> <item text="D2="d2"> <item text="D3="d3"> </item> </tree> So when I do a collapse all I want my tree to look like <tree id="0"> <item text="A="a"> <item text="B="b"> <item text="C="c"> <item text="D="d"> </tree> How can I achieve this.. when I do closeAllItems() it closes all the nodes. Thanks Answer posted by Support on Mar 17, 2008 10:05 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; }); |