Re: [flexcoders] Reloading Data Question
i strong recomended change to remote object, with httpservice only problems On 5/6/05, Tracy Spratt <[EMAIL PROTECTED]> wrote: Yes, when you use one of the dataProvider API methods. When you do:myDataGrid.removeItemAt(), you are really doing myDataGrid.dataProvider.removeItemAt().Note: When you update a cell in an editable datagrid column, the data isNOT automatically modified in the dataProvider. You must calleditField() in the updateField event handler. Tracy-Original Message-From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] OnBehalf Of David TerrySent: Friday, May 06, 2005 3:11 PM To: flexcoders@yahoogroups.comSubject: RE: [flexcoders] Reloading Data Question So let me try to understand this - I'm coming from a .Net world.When I create a control alters the data from the original -Original Message-From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] OnBehalf Of Manish Jethani Sent: Friday, May 06, 2005 13:52To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Reloading Data QuestionOn 5/6/05, David Terry <[EMAIL PROTECTED] > wrote:> Or is it going to be some like... > var objData:Object; > > objData = catalog.product.clone(); See this:http://www.macromedia.com/2003/mxml" xmlns="*"> import mx.utils.ObjectCopy; function copyObject(source:Object):Object { var newObject:Object = ObjectCopy.copy(source); ObjectCopy.copyProperties(newObject, source); return newObject; } elephant 4 human 2 grid.removeItemAt(0) copyObject() makes a copy of the object. Clicking on the"removeItemAt(0)" button removes the 1st item from the first gridonly. So the original data provider object (which the second grid uses directly) is not modified.Yahoo! Groups LinksYahoo! Groups Links Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Reloading Data Question
Yes, when you use one of the dataProvider API methods. When you do: myDataGrid.removeItemAt(), you are really doing myDataGrid.dataProvider.removeItemAt(). Note: When you update a cell in an editable datagrid column, the data is NOT automatically modified in the dataProvider. You must call editField() in the updateField event handler. Tracy -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of David Terry Sent: Friday, May 06, 2005 3:11 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Reloading Data Question So let me try to understand this - I'm coming from a .Net world. When I create a mailto:[EMAIL PROTECTED] On Behalf Of Manish Jethani Sent: Friday, May 06, 2005 13:52 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Reloading Data Question On 5/6/05, David Terry <[EMAIL PROTECTED]> wrote: > Or is it going to be some like... > var objData:Object; > > objData = catalog.product.clone(); See this: http://www.macromedia.com/2003/mxml"; xmlns="*"> import mx.utils.ObjectCopy; function copyObject(source:Object):Object { var newObject:Object = ObjectCopy.copy(source); ObjectCopy.copyProperties(newObject, source); return newObject; } elephant 4 human 2 grid.removeItemAt(0) copyObject() makes a copy of the object. Clicking on the "removeItemAt(0)" button removes the 1st item from the first grid only. So the original data provider object (which the second grid uses directly) is not modified. Yahoo! Groups Links Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Reloading Data Question
Oh, yeah, I forgot, that is actually what I use! I think slice will make a copy as well. Tracy From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matt Chotin Sent: Friday, May 06, 2005 3:39 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Reloading Data Question Sorry, I forgot to double-check I was using the real method name. myArray.concat() will produce a shallow copy of the array (meaning a new array that has the same contents). Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tracy Spratt Sent: Friday, May 06, 2005 12:35 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Reloading Data Question I guess "clone()" was psuedocode! I just found "objectCopy" in the livedocs flex api, and it is supposedly "for internal use only". But I also found Darron Schall's article about it here: http://www.darronschall.com/weblog/archives/000148.cfm Also, for a simple array of objects, it is easy to write your own copy routine. function arrayCopy(aArray:Array):Array { var aCopy:Array = new Array() for (var i:Number=0;i aCopy.push(aArray[i]); } } Tracy -Original Message- From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Manish Jethani Sent: Friday, May 06, 2005 2:52 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Reloading Data Question On 5/6/05, David Terry <[EMAIL PROTECTED]> wrote: > Or is it going to be some like... > var objData:Object; > > objData = catalog.product.clone(); See this: http://www.macromedia.com/2003/mxml" xmlns="*"> import mx.utils.ObjectCopy; function copyObject(source:Object):Object { var newObject:Object = ObjectCopy.copy(source); ObjectCopy.copyProperties(newObject, source); return newObject; } elephant 4 human 2 grid.removeItemAt(0) copyObject() makes a copy of the object. Clicking on the "removeItemAt(0)" button removes the 1st item from the first grid only. So the original data provider object (which the second grid uses directly) is not modified. Yahoo! Groups Links Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Reloading Data Question
Sorry, I forgot to double-check I was using the real method name. myArray.concat() will produce a shallow copy of the array (meaning a new array that has the same contents). Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tracy Spratt Sent: Friday, May 06, 2005 12:35 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Reloading Data Question I guess "clone()" was psuedocode! I just found "objectCopy" in the livedocs flex api, and it is supposedly "for internal use only". But I also found Darron Schall's article about it here: http://www.darronschall.com/weblog/archives/000148.cfm Also, for a simple array of objects, it is easy to write your own copy routine. function arrayCopy(aArray:Array):Array { var aCopy:Array = new Array() for (var i:Number=0;i aCopy.push(aArray[i]); } } Tracy -Original Message- From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Manish Jethani Sent: Friday, May 06, 2005 2:52 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Reloading Data Question On 5/6/05, David Terry <[EMAIL PROTECTED]> wrote: > Or is it going to be some like... > var objData:Object; > > objData = catalog.product.clone(); See this: http://www.macromedia.com/2003/mxml" xmlns="*"> import mx.utils.ObjectCopy; function copyObject(source:Object):Object { var newObject:Object = ObjectCopy.copy(source); ObjectCopy.copyProperties(newObject, source); return newObject; } elephant 4 human 2 grid.removeItemAt(0) copyObject() makes a copy of the object. Clicking on the "removeItemAt(0)" button removes the 1st item from the first grid only. So the original data provider object (which the second grid uses directly) is not modified. Yahoo! Groups Links Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Reloading Data Question
Interesting… Thank you very much for the information and the sample code. ~David T. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Manish Jethani Sent: Friday, May 06, 2005 14:26 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Reloading Data Question On 5/7/05, David Terry <[EMAIL PROTECTED]> wrote: > When I create a > control alters the data from the original Yes. If you call removeItemAt(0) on a DataGrid, it modifies the underlying DataProvider object. If you don't want it modified, you should assign a copy to it. Try this: assign the same DataProvider to two DataGrid instances, and then call removeItemAt(0) on one of the DataGrid's. The contens of both the DataGrid instances will be in sync because they both refer to the same data. Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Reloading Data Question
On 5/7/05, Tracy Spratt <[EMAIL PROTECTED]> wrote: > But I also found Darron Schall's article about it here: > http://www.darronschall.com/weblog/archives/000148.cfm > > Also, for a simple array of objects, it is easy to write your own copy > routine. > function arrayCopy(aArray:Array):Array { > var aCopy:Array = new Array() > for (var i:Number=0;i aCopy.push(aArray[i]); > } > } [probably off-topic now...] That creates a shallow copy. If you ever want to deepcopy _and_ have circular references resolved, then I wrote something that seems to work well: http://manish.revise.org/2005/04/deepcopying-actionscript-objects.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Reloading Data Question
On 5/7/05, David Terry <[EMAIL PROTECTED]> wrote: > When I create a control alters the data from the original To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Reloading Data Question
I guess "clone()" was psuedocode! I just found "objectCopy" in the livedocs flex api, and it is supposedly "for internal use only". But I also found Darron Schall's article about it here: http://www.darronschall.com/weblog/archives/000148.cfm Also, for a simple array of objects, it is easy to write your own copy routine. function arrayCopy(aArray:Array):Array { var aCopy:Array = new Array() for (var i:Number=0;imailto:[EMAIL PROTECTED] On Behalf Of Manish Jethani Sent: Friday, May 06, 2005 2:52 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Reloading Data Question On 5/6/05, David Terry <[EMAIL PROTECTED]> wrote: > Or is it going to be some like... > var objData:Object; > > objData = catalog.product.clone(); See this: http://www.macromedia.com/2003/mxml"; xmlns="*"> import mx.utils.ObjectCopy; function copyObject(source:Object):Object { var newObject:Object = ObjectCopy.copy(source); ObjectCopy.copyProperties(newObject, source); return newObject; } elephant 4 human 2 grid.removeItemAt(0) copyObject() makes a copy of the object. Clicking on the "removeItemAt(0)" button removes the 1st item from the first grid only. So the original data provider object (which the second grid uses directly) is not modified. Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Reloading Data Question
So let me try to understand this - I'm coming from a .Net world. When I create a mailto:[EMAIL PROTECTED] On Behalf Of Manish Jethani Sent: Friday, May 06, 2005 13:52 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Reloading Data Question On 5/6/05, David Terry <[EMAIL PROTECTED]> wrote: > Or is it going to be some like... > var objData:Object; > > objData = catalog.product.clone(); See this: http://www.macromedia.com/2003/mxml"; xmlns="*"> import mx.utils.ObjectCopy; function copyObject(source:Object):Object { var newObject:Object = ObjectCopy.copy(source); ObjectCopy.copyProperties(newObject, source); return newObject; } elephant 4 human 2 grid.removeItemAt(0) copyObject() makes a copy of the object. Clicking on the "removeItemAt(0)" button removes the 1st item from the first grid only. So the original data provider object (which the second grid uses directly) is not modified. Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Reloading Data Question
On 5/6/05, David Terry <[EMAIL PROTECTED]> wrote: > Or is it going to be some like… > var objData:Object; > > objData = catalog.product.clone(); See this: http://www.macromedia.com/2003/mxml"; xmlns="*"> import mx.utils.ObjectCopy; function copyObject(source:Object):Object { var newObject:Object = ObjectCopy.copy(source); ObjectCopy.copyProperties(newObject, source); return newObject; } elephant 4 human 2 grid.removeItemAt(0) copyObject() makes a copy of the object. Clicking on the "removeItemAt(0)" button removes the 1st item from the first grid only. So the original data provider object (which the second grid uses directly) is not modified. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Reloading Data Question
Also, you don’t use binding braces in AS script: lstElements.dataProvider = "{catalog.product}" I’d do something like: var oDPInitial:Object = catalog.product.clone(); Then in Reload: lstElements.dataProvider = oDPInitial; Tracy From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matt Chotin Sent: Friday, May 06, 2005 12:58 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Reloading Data Question Maybe try doing dataProvider=”{catalog.product.clone()}”. Basically the problem is that you’re messing with your original dataProvider and deleting everything in it. You need to pass your TileList a copy of the dataProvider so that you can muck with it without doing permanent damage. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of David Terry Sent: Friday, May 06, 2005 8:17 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Reloading Data Question Hello, I hope everyone is having a happy Friday. I have another basic question for everyone – How do you reload data into a tileList or in general? So… I have a tileList that is feed from an XML file. The user can drag items from the list to a canvas, and I remove the item from the tileList. There is a button to clear both the tileList and the canvas, but I want to reload the data back into the tileList. How? Cuz my code just isn’t working. Many thanks, ~David T. +++CODE+ My TileList cellRenderer="lstThumbnail" x="10" y="38" borderColor="#CC" borderThickness="1" highlightColor="#FF" dragEnabled="true" backgroundColor="#FF" barColor="#FF" rollOverColor="#FF" selectionColor="#F0F0F0" columnCount="1" borderStyle="solid" itemWidth="160" dragComplete="doDragComplete(event)" /> My XML File My Clear & Reload Function function ReloadContainers(){ lstElements.removeAll(); cvsCanvas.destroyAllChildren(); lstElements.dataProvider = "{catalog.product}" } END CODE+ Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Reloading Data Question
Hi Matt, Thanks for the info, but I’m a very new to ActiveScript. Any chance you have some code examples of making a clone? Or is it going to be some like… var objData:Object; objData = catalog.product.clone(); object.dataProvider=”{objDate}” ~David T. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin Sent: Friday, May 06, 2005 11:58 To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Reloading Data Question Maybe try doing dataProvider=”{catalog.product.clone()}”. Basically the problem is that you’re messing with your original dataProvider and deleting everything in it. You need to pass your TileList a copy of the dataProvider so that you can muck with it without doing permanent damage. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of David Terry Sent: Friday, May 06, 2005 8:17 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Reloading Data Question Hello, I hope everyone is having a happy Friday. I have another basic question for everyone – How do you reload data into a tileList or in general? So… I have a tileList that is feed from an XML file. The user can drag items from the list to a canvas, and I remove the item from the tileList. There is a button to clear both the tileList and the canvas, but I want to reload the data back into the tileList. How? Cuz my code just isn’t working. Many thanks, ~David T. +++CODE+ My TileList cellRenderer="lstThumbnail" x="10" y="38" borderColor="#CC" borderThickness="1" highlightColor="#FF" dragEnabled="true" backgroundColor="#FF" barColor="#FF" rollOverColor="#FF" selectionColor="#F0F0F0" columnCount="1" borderStyle="solid" itemWidth="160" dragComplete="doDragComplete(event)" /> My XML File My Clear & Reload Function function ReloadContainers(){ lstElements.removeAll(); cvsCanvas.destroyAllChildren(); lstElements.dataProvider = "{catalog.product}" } END CODE+ Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Reloading Data Question
Maybe try doing dataProvider=”{catalog.product.clone()}”. Basically the problem is that you’re messing with your original dataProvider and deleting everything in it. You need to pass your TileList a copy of the dataProvider so that you can muck with it without doing permanent damage. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of David Terry Sent: Friday, May 06, 2005 8:17 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Reloading Data Question Hello, I hope everyone is having a happy Friday. I have another basic question for everyone – How do you reload data into a tileList or in general? So… I have a tileList that is feed from an XML file. The user can drag items from the list to a canvas, and I remove the item from the tileList. There is a button to clear both the tileList and the canvas, but I want to reload the data back into the tileList. How? Cuz my code just isn’t working. Many thanks, ~David T. +++CODE+ My TileList cellRenderer="lstThumbnail" x="10" y="38" borderColor="#CC" borderThickness="1" highlightColor="#FF" dragEnabled="true" backgroundColor="#FF" barColor="#FF" rollOverColor="#FF" selectionColor="#F0F0F0" columnCount="1" borderStyle="solid" itemWidth="160" dragComplete="doDragComplete(event)" /> My XML File My Clear & Reload Function function ReloadContainers(){ lstElements.removeAll(); cvsCanvas.destroyAllChildren(); lstElements.dataProvider = "{catalog.product}" } END CODE+ Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.