Reputation: 9765
I have a simple flex tree, and I'd like to expand it after data load. but the tree is not expanding by expandChildrenOf method, expandItem, or openItems.
I could expand tree manually, though.
Here is the script:
private function resultHandler(event:ResultEvent):void
{
xmlTree = XML(event.result as String);
tree.dataProvider = xmlTree;
callLater(myExpandTree);
}
private function myExpandTree() : void {
tree.expandChildrenOf(tree.root, true);
}
....
<mx:RemoteObject id="ro" destination="myList"
result="resultHandler(event)"
fault="faultHandler(event)"/>
<mx:XML id="xmlTree"/>
<mx:Tree id="tree" dataProvider="{xmlTree}"
editable = "true"
iconFunction="tree_iconFunc"
labelField="@label"
width="100%" height="100%" showRoot="false" />
Upvotes: 0
Views: 366
Reputation: 21984
This is what I used to expand the tree.
private function expandRootNode():void { tree.expandItem(xmlTree,true); //expand the root node }
Upvotes: 1