13 Replies Latest reply on Dec 7, 2008 10:42 PM by gallaharsha

    How to Expand All Nodes on Tree

    FrankyG813
      I found examples of this but I'm having a hard time figuring out why it does not work.
      Here's my code..Any help appreciated.

      My function;
      private function expandTreeNodes():void{
      var projectParts:XML = treLinks.dataProvider[0];
      treLinks.openItems = projectParts..node;
      /* I even tried the code below to no avail
      ** for each (var item:XML in projectParts..node){
      ** treLinks.expandItem(item, true);
      ** }
      */
      }
      My dataprovider for the tree;
      <mx:XMLListCollection id="projectParts">
      <mx:XMLList>
      <node label="Product" data="100">
      <node label="Part A" data="70"/>
      <node label="Part B" data="10">
      <node label="Component a" data="2"/>
      <node label="Component b" data="3"/>
      <node label="Component c" data="0" isBranch="true" />
      <node label="Component d" data="5" />
      </node>
      <node label="Part C" data="15"/>
      <node label="Part D" data="5"/>
      </node>
      </mx:XMLList>
      </mx:XMLListCollection>
      My Tree:
      <mx:Tree id="treLinks" x="10" y="10" width="680" height="298" fontSize="10" labelField="@label" dataProvider="{projectParts}" creationComplete="expandTreeNodes()" />