Yes, I have gotten so far too.

The problem is I want to open the items directly, without a user clicking on something.

 

Before I could just set myTree.selectedIndex to 0, and after that myTree.expandChildrenOf(myTree.selectedItem, true);

But after debugging, I found that if you set the selectedIndex to 0, it doesn’t set the selectedItem, it stays null until a user clicks on a node.

 

I should be able to trigger it without doing that, but I can’t find it…

 

Help! :-)

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mac Martine
Sent: woensdag 28 juni 2006 17:38
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Expand all items of a tree

 

 

It’s working for me. Here’s an example. I’m not sure what you are wanting to do, but in this example you have to select a tree item, then click the Expand All button. You can modify it as desired.

 

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

<!-- Tree control example. -->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

 

    <mx:Script>

        <![CDATA[

 

            [Bindable]

            public var selectedNode:Object;

 

            // Event handler for the Tree control change event.

            public function treeChanged(event:Event):void {

                selectedNode=Tree(event.target).selectedItem;

            }

           

            private function expand():void

            {

                        myTree.expandChildrenOf(myTree.selectedItem, true);

            }

        ]]>

    </mx:Script>

 

    <mx:XMLList id="treeData">

        <node label="Mail Box">

            <node label="Inbox">

                <node label="Marketing"/>

                <node label="Product Management"/>

                <node label="Personal"/>

            </node>

            <node label="Outbox">

                <node label="Professional"/>

                <node label="Personal"/>

            </node>

            <node label="Spam"/>

            <node label="Sent"/>

        </node>   

    </mx:XMLList>

            <mx:Tree id="myTree" width="427" height="410" labelField="@label"

                showRoot="false" dataProvider="{treeData}" change="treeChanged(event)"/>

 

    <mx:Button label="Expand all" click="expand()"/>

</mx:Application>

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Jonas Windey
Sent: Wednesday, June 28, 2006 7:31 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Expand all items of a tree

 

Sorry to bump this, but I’m desperately looking for a solution..

 

Jonas

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Jonas Windey
Sent: woensdag 28 juni 2006 12:01
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Expand all items of a tree

 

Hi, in flex2b3, I could open all nodes of my tree by doing this:

 

treeTest.selectedIndex = 0;

treeTest.expandChildrenOf(treeTest.selectedItem, true);   

 

Unfortunately, this isn’t working anymore.

 

I tried treeTest.expandItem(treeData.node[0],true, false); , teeTest.expandChildrenOf(treeTest.firstVisibleItem), but no luck.

 

Who helps?

 

Jonas


__________ NOD32 1.1629 (20060628) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


__________ NOD32 1.1630 (20060628) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to