我有一个树形控件,在我放下一个项目(更新数据提供者)之后,我希望它保持打开状态。我尝试了很多东西,包括this question的示例,这些示例我无法工作,所以我正在做一些我觉得更基本的事情。像这样:Flex Tree没有重新扩展
[Bindable]
public var open:Object = new Object();
private function dropItemInTree():void{
open = myTree.openItems;
//A bunch of code that updates the DP
reopenTree();
}
public function reopenTree():void{
for each(var item:XML in open){
expandParents(item[0]);
}
}
private function expandParents(node:XML):void {
myTree.expandItem(node,true,false);
}
但即使这样也会让我的树最小化。出了什么问题?
XMLTree1.expandItem(MailBox.getItemAt(0),真,假,真); 它的第四个参数。设置它,你的代码应该工作。有关更多详情,请参阅下面的答案。 – 2010-02-09 19:02:41
第四个参数仅用于在expandItem方法运行时调度itemOpen事件。在这种情况下,我甚至无法使用expandItem方法打开一个项目,因此将事件触发并链接到该事件也不起作用。 – invertedSpear 2010-02-09 20:27:34