修正了Flex Tree 控件在動態加載節點后 Scrollbar 沒有立即出現的問題
2011-09-16 15:49 Koy 阅读(261) 评论(0) 编辑 收藏 举报
var _loadSubFolder:Function = function(children:Array):void{
node.children = new ArrayCollection(children);
for each(var glossaryfolder:Object in node.children){
if(glossaryfolder.child_count > 0){
glossaryfolder.children = childrenMark; //replace the template
}
}
//very important for showing tree scrollbar.
var arr:Array = grpTree.openItems as Array;
var openItems:ArrayCollection = new ArrayCollection(arr);
for(var i:int=0;i<openItems.length;i++){
if(openItems[i] == node){
openItems.removeItemAt(i);
openItems.refresh();
}
}
grpTree.openItems = openItems.toArray();
grpTree.expandItem(node, true);
grpTree.invalidateList();
grpTree.invalidateDisplayList();
}
node.children = new ArrayCollection(children);
for each(var glossaryfolder:Object in node.children){
if(glossaryfolder.child_count > 0){
glossaryfolder.children = childrenMark; //replace the template
}
}
//very important for showing tree scrollbar.
var arr:Array = grpTree.openItems as Array;
var openItems:ArrayCollection = new ArrayCollection(arr);
for(var i:int=0;i<openItems.length;i++){
if(openItems[i] == node){
openItems.removeItemAt(i);
openItems.refresh();
}
}
grpTree.openItems = openItems.toArray();
grpTree.expandItem(node, true);
grpTree.invalidateList();
grpTree.invalidateDisplayList();
}