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 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: Sorry to bump this, but I’m desperately looking for a
solution.. Jonas From: 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
-- 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
YAHOO! GROUPS LINKS
|
- RE: [flexcoders] Expand all items of a tree Jonas Windey
- Re: [flexcoders] Expand all items of a tree David Clark