objectUtil.copy is working ....
sincere thanks for your suggestions....
--- In [email protected], Sherif Abdou <[EMAIL PROTECTED]> wrote:
>
> actually here is a btter one where u use the ObjectUtil.copy()
> <?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
> * 
> */
> for(var i:int=0;i<myOriginalCollection.length;i++){
> var myObject:Object=ObjectUtil.copy(myOriginalCollection.getItemAt(i));
> 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 <sherif626@ ..> 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
>


Reply via email to