1 Reply Latest reply on Nov 26, 2008 10:09 PM by Raju Khinda

    On selction of a node, close siblings in Tree 

    Raju Khinda
      Hi,
      How can we close sibling branche when we are selecting a node in Tree component.
      For example,
      Node 1
      Child Node 1
      ..................
      Child Node 2
      Node 2
      Child Node 1
      ..................
      Child Node 2
      When i m selecting "Node 1 >>Child Node 2" then "Node>>Child Node 1" should be closed .I m using XMLList for Tree data provider.

      Thanks
      Raj
        • 1. Re: On selction of a node, close siblings in Tree 
          Raju Khinda Level 1
          It is working for me now .

          private function openItem(event:TreeEvent):void {
          //myTree is Id of tree component .
          myTree.selectedItem = event.item; //"event.item" current selected Item.

          var node:XML = XML(myTree.selectedItem);
          var children:XMLList = XMLList(node.parent()).children();
          for(var i:Number=0; i < children.length(); i++) {
          if( children .@label != node.@label) {
          myTree.expandItem(children
          ,false);
          }

          }
          }