为什么 Flex 树无法在程序中打开?
我有一个简单的弹性树,我想在数据加载后扩展它。 但树无法通过 ExpandChildrenOf 方法、expandItem 或 openItems 进行扩展。
不过,我可以手动扩展树。
这是脚本:
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" />
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" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我用来扩展树的方法。
私有函数 ExpandRootNode():void
{
树.expandItem(xmlTree,true); //展开根节点
}
This is what I used to expand the tree.
private function expandRootNode():void
{
tree.expandItem(xmlTree,true); //expand the root node
}