I was stuck with this aswell a while ago this is my solution:

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
creationComplete="init()" >

      

      <mx:Script>

            private function init():void{

                  menuTree.openItems = menuData..node;

            }

            </mx:Script>

      

      <mx:XML id="menuData" > 

            <node label="menu">

                  <node label="Data Management">

                    <node label="Registration"/>

                    <node label="Customer List"/>

              </node>

             <node label="System Administration">

               <node label="Add Users"/>

             </node>

          </node> 

      </mx:XML>

 

      

      <mx:Tree id="menuTree" top="72" left="50" showRoot="false"

         height="224" labelField="@label" dataProvider="{menuData}"/>

 

</mx:Application>

 

 

Paul K

 

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of pbrendanc
Sent: Thursday, 4 December 2008 3:16 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Auto expand TreeView on open - How?

 

I want to auto expand my menu treeview immediately on open - the
following code is called from thecreationComplete="initTree();" and
expands the first node only. 

Is there a way to expand all nodes - I can't seem to get this to work.
(Other have reported problems so I wonder if this is supported)?

TIA,
Patrick

(The data provider for the tree is an XMLList)

<mx:XMLList id="menuData" > 
<node label="Data Management">
<node label="Registration"/>
<node label="Customer List"/>
</node>
<node label="System Administration">
<node label="Add Users"/>
</node> 

private function initTree():void {

//Expands first visible Tree Item
menuTree.expandItem(menuTree.firstVisibleItem,true); 
} 



 

Reply via email to