2 Replies Latest reply on Sep 11, 2006 8:50 PM by peterent

    Item Renderer


      I have a simple datagrid in which one of the column is a quantity field. The user can change the quantity for any row. So I have something like:

      <mx:DataGrid dataProvider="{arrTest}" width="100%" height="100%" >
      <mx:DataGridColumn dataField="Name" />
      headerText="Quantity" dataField="Quantity"
      itemRenderer="mx.controls.TextInput" />

      I am not exactly sure how should I get all the updated values in the datagrid so that I can update the database.

        • 1. Re: Item Renderer
          Diemos Level 1
          You could use a button that would loop through the data in the grid and submit it to the database as an upadte. Or use the change event to process that cell and update as the user types. Either that or the keyup event should work.
          • 2. Re: Item Renderer
            peterent Level 2
            Since you are want to edit the cell, you should use itemEditor="mx.controls.TextInput" along with editorProperty="text". But if you are using TextInput, then just do editable="true" on the DataGridColumn as TextInput is the default editor for the cell and save yourself some work.

            The changes are stored in your dataProvider, so following Diemos's advice, loop through your dataProvider to build your request back to the server. Although what you build greatly depends on which data service you are using. For example, if you are using RemoteObject, then you might be able to send your dataProvider as-is. If you are using a HTTPService, you may need to send an XML document.