I've found this works a bit better... scrollbar for tree container doesn't
update for me using the openItems method...

for each (var item:XML in treeDataProviderXML..node)
{
     tree.expandItem(item, true);
}


Brendan

On Jul 16, 2007 10:06 AM, app.developer <[EMAIL PROTECTED]> wrote:

>   When the flex Tree fires creationComplete, I call the expandTreeNode
> to expand all nodes. "treeData..node" means I'm expanding all nodes
> that are called "node", so if you have another name such as <folder
> label="cert1"> then you would need to address it as
> flexTree.openItems = treeData..folder
>
> private function expandTreeNodes():void{
> var treeData:XML = flexTree.dataProvider[0];
> flexTree.openItems = treeData..node;
> }
>
> <mx:XMLListCollection id="treeData">
> <mx:XMLList>
> <node label="Curr" >
> <node label="cert1" >
> <node label="c1" />
> <node label="c2" />
> </node>
> ...
> </node>
>
> </mx:XMLList>
> </mx:XMLListCollection>
>
> <mx:Tree id="flexTree" dataProvider="{treeData}"
> creationComplete="expandTreeNodes()">
>
> Precia
>
>
> --- In [email protected] <flexcoders%40yahoogroups.com>,
> [EMAIL PROTECTED] wrote:
> >
> > /******
> > I need a faster "expandAll()" or "collaspeAll()" function for the
> Flex
> > Tree component.
> > I want to expand the Tree completely open or completely closed.
> >
> > This is what I have so far, but its too slow for a Tree with many
> nodes
> > in it.
> > Plus it requires an item of the Tree to be selected first.
> >
> > I think the reason it get slower is because the "Tree.openedItems"
> > property is an
> > Object containing all the opened items but not the one's I expanded
> at
> > one time.
> >
> > Does anyone have cleaner,faster way?
> > *******/
> >
> > private function expandAll(tree:Tree,open:Boolean):void
> > {
> > var opened:Object;
> > function expand(obj:Object):void
> > {
> > tree.expandChildrenOf(obj,open);
> > opened=tree.openItems;
> > for each(var o:Object in opened){
> > if(tree.isItemOpen(o) != open){
>
> > tree.expandItem(o,open);
>
> > }
> > }
> > }
> > expand(tree.selectedItem);
> > }
> >
> > --Keith H--
> >
>
>  
>



-- 
Brendan Meutzner
http://www.meutzner.com/blog/

Reply via email to