Good day.

Learning Flex here for the past two (like three actually) weeks.  Using only 
mxml compiler.

I have a question with regards to the above subject:

Assuming I declared an ArrayCollection as follows:

[Bindable] private var _arrItems:ArrayCollection = new 
ArrayCollection([{"itemNo":"1", "testItem":"Angelo"}, {"itemNo":"2", 
"testItem":"Dinah"}]);

This array I am binding to a datagrid as follows:

<mx:DataGrid id="dgOutwardList" 
  dataProvider="{_arrItems}" 
  useRollOver="false" 
  height="450"
  width="100%" 
  verticalScrollPolicy="auto" 
  sortableColumns="false" 
  draggableColumns="false" 
  resizableColumns="false">
 <mx:columns>
 <mx:DataGridColumn headerText="" dataField="itemNo" width="20"/>
 <mx:DataGridColumn headerText="Name of Passengers" dataField="testItem" 
width="200">
  <mx:itemRenderer>
   <mx:Component>
    <mx:TextInput width="100%" />
   </mx:Component>
  </mx:itemRenderer>
 </mx:DataGridColumn>
 
 </mx:columns>
</mx:DataGrid>

No problem initially, as the itemNo and the testItem values are displayed 
properly on the datagrid.

Now for example, if I modified my first row which contains itemNo:1 and 
testItem:Angelo, where I changed Angelo to Mickey, will the dataprovider 
reflect the change in the said row?
How do I make so that the changes in the datagrid be reflected into the 
ArrayCollection?  such that when I changed the testItem data for the first row 
and access the item, via:

_arrItems.getItemAt(arrLength -1).itemNo
_arrItems.getItemAt(arrLength -1).testItem

The result would be "1" and "Mickey" respectively?

I am a bit puzzled on how databinding actually works in Flex. Is it like a 
two-way live update (such that when you modify the value in the datagrid, it is 
reflected back to the arraycollection)?

Would love to hear your inputs.

Thanks and regards,
Angelo


      

Reply via email to