o sorry, i forgot about the whole by reference and by value <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()" > <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.utils.ObjectUtil; [Bindable] private var myOriginalCollection:ArrayCollection = new ArrayCollection([{label:"Flex",source:"Coders"}]); private var myBackUpCollection:ArrayCollection = new ArrayCollection(); private function initApp():void{ /** * All Right I forgot about the whole idea of by reference and by value so what we need * to do is create a ByteArray write the object so there is a disconnect and add it * to the backup so now we have it by value instead of by reference. * you can probably fix the code a bit and make it prettier but here is the jist of it * */ var byteArray:ByteArray = new ByteArray(); var myObject:Object for(var i:int=0;i<myOriginalCollection.length;i++){ byteArray.writeObject(myOriginalCollection.getItemAt(0)); byteArray.position=0; myObject = byteArray.readObject(); myBackUpCollection.addItem(myObject); } } ]]> </mx:Script> <mx:DataGrid dataProvider="{myOriginalCollection}" editable="true" mouseDown="trace(myBackUpCollection.getItemAt(0).label)"/> </mx:WindowedApplication>
----- Original Message ---- From: rahul_kandari2005 <[EMAIL PROTECTED]> To: [email protected] Sent: Tuesday, January 29, 2008 12:07:45 AM Subject: [flexcoders] Re: on editing datagrid I have tried this code but whenever i am editing data grid myCollection2 also gets updated. --- In [EMAIL PROTECTED] ups.com, Sherif Abdou <[EMAIL PROTECTED] ..> wrote: > > just do this > > <mx:DataGrid dataProvider{ myCollection1} creationComplete= "{myCollection2= myCollection1} "/> so whatever happens collection 2 is the orgiinal. > > > ----- Original Message ---- > From: rahul_kandari2005 <kandari.rahul@ ...> > To: [EMAIL PROTECTED] ups.com > Sent: Monday, January 28, 2008 11:10:27 PM > Subject: [flexcoders] Re: on editing datagrid > > yes that is what i want but editing datagrid bring changes in > all array collection.Is it Possible to do--> (i m working in flex 2). > --- In [EMAIL PROTECTED] ups.com, Sherif Abdou <sherif626@ ..> wrote: > > > > well i gues then you would need two copies of the dataProvider, one > original and one changed. > > > > ----- Original Message ---- > > From: rahul_kandari2005 <kandari.rahul@ ...> > > To: [EMAIL PROTECTED] ups.com > > Sent: Monday, January 28, 2008 10:57:20 PM > > Subject: [flexcoders] Re: on editing datagrid > > > > I want change in the data grid but not in the array collection because > > array collection also gets changed on editing data grid.... > > --- In [EMAIL PROTECTED] ups.com, Sherif Abdou <sherif626@ ..> wrote: > > > > > > so you want changes to appear in the datagrid or still have the old > > data? > > > > > > ----- Original Message ---- > > > From: Rahul Kandari <kandari.rahul@ ...> > > > To: [EMAIL PROTECTED] ups.com > > > Sent: Monday, January 28, 2008 10:43:15 PM > > > Subject: [flexcoders] on editing datagrid > > > > > > hi, > > > i m currently working on a editable datagrid. On editing the data > > grid the array collection which is a source > > > or dataprovider for datagrid also changes same as data > > provider.how can this be prevented. > > > > > > > > > > > > > > > > > > > > ____________ _________ _________ _________ _________ _________ _ > > > Looking for last minute shopping deals? > > > Find them fast with Yahoo! Search. > > http://tools. search.yahoo. com/newsearch/ category. php?category= > shopping > > > > > > > > > > > > > > > > ____________ _________ _________ _________ _________ _________ _ > > Never miss a thing. Make Yahoo your home page. > > http://www.yahoo. com/r/hs > > > > > > > > ____________ _________ _________ _________ _________ _________ _ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. http://tools. search.yahoo. com/newsearch/ category. php?category= shopping > ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping

