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.
我有一个简单的flex树,我想在数据加载后扩展它。但是这个树没有通过expandChildrenOf方法,expandItem或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" />
1 个解决方案
#1
1
This is what I used to expand the tree.
这就是我用来扩展树的方法。
private function expandRootNode():void { tree.expandItem(xmlTree,true); //expand the root node }
private function expandRootNode():void {tree.expandItem(xmlTree,true); //展开根节点}
#1
1
This is what I used to expand the tree.
这就是我用来扩展树的方法。
private function expandRootNode():void { tree.expandItem(xmlTree,true); //expand the root node }
private function expandRootNode():void {tree.expandItem(xmlTree,true); //展开根节点}