Re: [flexcoders] Tree problems
I actually stuck a placeholder on to the empty array and now everything seems to be working out ok, thanks for the help guys! Thank You Dan Vega danv...@gmail.com http://www.danvega.org On Sat, Dec 20, 2008 at 4:29 PM, Dan Vega wrote: > Same result .. > > private function listDirectories(event:ResultEvent):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 { > hold.children = dirs; > } > //trace( ObjectUtil.toString(_directories) ); > (tree.dataProvider as ArrayCollection).dispatchEvent(new > CollectionEvent(CollectionEvent.COLLECTION_CHANGE)); > } > >
Re: [flexcoders] Tree problems
Same result .. private function listDirectories(event:ResultEvent):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 { hold.children = dirs; } //trace( ObjectUtil.toString(_directories) ); (tree.dataProvider as ArrayCollection).dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE)); }
Re: [flexcoders] Tree problems
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 To: flexcoders@yahoogroups.com 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 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 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 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.
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 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 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 >> *To:* flexcoders@yahoogroups.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. >> >> >> > >
Re: [flexcoders] Tree problems
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 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 > *To:* flexcoders@yahoogroups.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. > > >
Re: [flexcoders] Tree problems
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 To: flexcoders@yahoogroups.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.
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:ResultEvent):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.
RE: [flexcoders] Tree problems
Sorry, it looked like you were working with the itemOpen event. I don't think folks are using that. I think most use the getChildren call to request the children, then when they arrive, they stuff the children into that same collection, probably using addItem. From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Dan Vega Sent: Friday, December 19, 2008 9:36 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Tree problems If you read through the post I am actually passed that and now trying to figure out how to dynamically insert / remove nodes. Dan
Re: [flexcoders] Tree problems
If you read through the post I am actually passed that and now trying to figure out how to dynamically insert / remove nodes. Dan
RE: [flexcoders] Tree problems
Typically, this is done via a customized ITreeDataDescriptor. It should always return true for isBranch and hasChildren, and return an empty ArrayCollection for getChildren that you fill later with the actual children. From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Dan Vega Sent: Friday, December 19, 2008 7:35 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Tree problems I am still having some tree / array issues that I am hoping to get some help on. My tree loads an array of data that looks like this. Items with a children array tell me that this folder should be a branch and it has children. When you click on the branch I want to go retrieve the list of directories for that folder and update the array with the new directory data. (Array)#0 [0] (Object)#1 lastModified = 1225560062218 name = "bin" parent = "H:\JRun4" path = "H:\JRun4\bin" [1] (Object)#2 children = (Array)#3 lastModified = 1186192523437 name = "docs" parent = "H:\JRun4" path = "H:\JRun4\docs" My itemOpen listener event basically get the path of the folder being opened and fetch the directories for that path. private function onItemOpen(event:TreeEvent):void { var path:String = event.item.path; holder = event.item.children; FileManager.getDirectories(path); } When the list of directories is called this method is the result handler. IF the tree data provider is null we know its top level. What I thought I could do is setup a variable called holder that would the array object of the item above. I thought this would pass the reference of that object and using that reference i could set the new dirs into that empty array. This is not really working so I was wondering if anyone has some ideas or what the right approach should be. private function listDirectories(event:ResultEvent):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 { // what do we do now? holder = dirs; } } Thanks for the help! Thank You Dan Vega danv...@gmail.com<mailto:danv...@gmail.com> http://www.danvega.org
[flexcoders] Tree problems
I am still having some tree / array issues that I am hoping to get some help on. My tree loads an array of data that looks like this. Items with a children array tell me that this folder should be a branch and it has children. When you click on the branch I want to go retrieve the list of directories for that folder and update the array with the new directory data. (Array)#0 [0] (Object)#1 lastModified = 1225560062218 name = "bin" parent = "H:\JRun4" path = "H:\JRun4\bin" [1] (Object)#2 children = (Array)#3 lastModified = 1186192523437 name = "docs" parent = "H:\JRun4" path = "H:\JRun4\docs" My itemOpen listener event basically get the path of the folder being opened and fetch the directories for that path. private function onItemOpen(event:TreeEvent):void { var path:String = event.item.path; holder = event.item.children; FileManager.getDirectories(path); } When the list of directories is called this method is the result handler. IF the tree data provider is null we know its top level. What I thought I could do is setup a variable called holder that would the array object of the item above. I thought this would pass the reference of that object and using that reference i could set the new dirs into that empty array. This is not really working so I was wondering if anyone has some ideas or what the right approach should be. private function listDirectories(event:ResultEvent):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 { // what do we do now? holder = dirs; } } Thanks for the help! Thank You Dan Vega danv...@gmail.com http://www.danvega.org
[flexcoders] tree problems
hi , I'm a flex developer and am new to this group..Well am encountering problems with trees...:) How do I add a child to a node at runtime? Will be eagerly waiting for your replies.. Thanks a ton srinath -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.