I didn't know this.

When I tried it, it didn't update the dataprovider. Is there anything special 
that needs to happen.


--- In [email protected], "Tracy Spratt" <tr...@...> wrote:
>
> Data  binding in general is not two-way, but an editable datagrid is a
> special case.  It will update the dataProvider items automatically.
> 
>  
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
>   _____  
> 
> From: [email protected] [mailto:[email protected]] On
> Behalf Of valdhor
> Sent: Friday, June 12, 2009 9:42 AM
> To: [email protected]
> Subject: [flexcoders] Re: ArrayCollection and Datagrid Binding and
> DataProvider Question
> 
>  
> 
> 
> 
> 
> 
> 
> Basically, no. The datagrid is like a window into your dataprovider.
> 
> If you need to modify your dataprovider you need to listem for the
> itemEditEnd event, grab the data that was modified and update the underlying
> dataprovider.
> 
> The data binding will note that the dataprovider has changed and will update
> the datagrid on the next redraw.
> 
> What data binding does is add an event dispatcher to the variable you have
> defined as bindable. When the variable changes an event is generated to let
> any component that is bound to that variable know that the variable has
> changed and update itself with the new data.
> 
> Now, As I understand it (And I could be wrong) Flex 4 (Gumbo) does do full
> two way data binding. I have not read up on what or how it does this but it
> sounds interesting.
> 
> HTH
> 
> Steve
> 
> --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> Angelo Anolin <angelo_anolin@> wrote:
> >
> > 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