I believe the tree listens for the CollectionEvent.COLLECTION_CHANGE event from 
the dataprovider to update its view. an array does not dispatch this event but 
you can try doing it yourself (myTree.dataProvider as 
ArrayCollection).dispatch(new CollectionEvent( ...




________________________________
From: Dan Vega <[email protected]>
To: [email protected]
Sent: Saturday, December 20, 2008 11:37:11 AM
Subject: Re: [flexcoders] Tree problems


Well i used that approach before and now I am back to using the same approach. 
A placholder to that array works great but the problem I had before is coming 
up again. when I click the folder no data shows up but the data is in the 
array. If i close it and open it again it shows up. The tree is just not 
updating for whatever reason. Is there something I need to do to refresh 
everything? 

Dan




On Sat, Dec 20, 2008 at 2:17 PM, Dan Vega <danv...@gmail. com> wrote:

The current target of the event is that, I don't think that will work? 
mx.rpc.remoting. mxml.Operation (@2a9494c1)




On Sat, Dec 20, 2008 at 11:01 AM, ivo <cervantes_vive@ yahoo.com> wrote:

The way I have handled it is by getting a reference to the children array and 
update the array with the retrieved data, somethin akin to:

private function listDirectories( event:ResultEven t):void {
    var _node:Object = event.currentTarget ;
    _node.children = event.result as Array;
}

- Ivo








________________________________
From: Dan Vega <danv...@gmail. com>
To: flexcod...@yahoogro ups.com
Sent: Friday, December 19, 2008 10:28:29 PM

Subject: Re: [flexcoders] Tree problems


I am not sure what you mean by getChildren( ) though, when a branch is clicked 
this method is called.

            private function onItemOpen(event: TreeEvent) :void {
                var path:String = event.item.path;
                FileManager. getDirectories( path);
                
            }

The getDirectories( ) method of the remote object call has a result handler 
called listDirectories( ). So based on the path of the node that is clicked 
(request for drill down) we make a remote call to get a list of directories for 
that path. Im not sure between these 2 stpes how to add my new array of 
directories to the empty children array of the node that was clicked.

            private function listDirectories( event:ResultEven t):void {

                var dirs:Array = event.result as Array;
                            
                // if the _directories array is null this is our root request
                if(_directories == null) {
                    _directories = dirs;
                }else {
                   //?????????
                }
            }


hope that makes a little more sense.

 

    

Reply via email to