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 <mx:Model of data and bind that to a control, the
control alters the data from the original <mx:Model state?




-----Original Message-----
From: flexcoders@yahoogroups.com [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:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
  xmlns="*">
  <mx:Script>
    import mx.utils.ObjectCopy;
    function copyObject(source:Object):Object
    {
      var newObject:Object = ObjectCopy.copy(source);
      ObjectCopy.copyProperties(newObject, source);
      return newObject;
    }
  </mx:Script>
  <mx:Model id="model">
    <root>
      <item>
        <creature>elephant</creature>
        <legs>4</legs>
      </item>
      <item>
        <creature>human</creature>
        <legs>2</legs>
      </item>
    </root>
  </mx:Model>
  <mx:DataGrid id="grid" dataProvider="{copyObject(model.root).item}" />
  <mx:Button click="grid.removeItemAt(0)">
    <mx:label>grid.removeItemAt(0)</mx:label>
  </mx:Button>
  <mx:DataGrid id="grid2" dataProvider="{model.root.item}" />
</mx:Application>

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/
 


Reply via email to