hi,
Eventhough you havent declared the variable testArr as Bindable you
still binded your arraycollection to the datagrids
line ---> <mx:DataGrid x="30" y="46" dataProvider="{testArr}"
editable="true">
here -----> dataProvider="{testArr}" - Using the curly braces ({})
syntax also specifies data binding...
so, your data grids are binded to the arraycollection and any change
to arraycollection will be updated to the datagrids
when you change values in one dataGrid the arrayCollection is changed
since other datagrid is binded with this arrayCollection its values
get updated....
but testArr is not Binded, so, if you replace it with any other value
it will not get updated in your datagrids
for example in the code you provided check by adding the below code
public function appComplete():void{
//testArr.setItemAt({First:'a',Second:'b',Third:'c'},
0) //!-this will update the grids since the arraycollection is changed
and datagrids are binded with this arraycollection
// testArr = new ArrayCollection
([{First:'a',Second:'b',Third:'c'}]);//!- here testArr variable has
been replace with another arraycollection..... only testArr variable
has changed not arraycollection //-so this change will not be
reflected in datagrids
//!-but if you have made testArr Bindable then both the above codes
will update the dataGrids
}
On Nov 18, 8:16 pm, pradeep gorijavolu <[email protected]>
wrote:
> Please you can find the code here
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute"
> preinitialize="initApp()"
> >
>
> <mx:Script>
> <![CDATA[
> import mx.controls.Alert;
> import mx.collections.ArrayCollection;
>
> private var testArr:ArrayCollection;
> [Bindable]
> private var text:String = "pradeep";
> public function initApp():void{
>
> testArr = new
> ArrayCollection([{First:'1',Second:'2',Third:'3'}]);
> }
> public function appComplete():void{
> Alert.show("execute");
> text = "kumar";
> }
> ]]>
> </mx:Script>
> <mx:Label text="{text}"/>
> <mx:Text text="{text}" x="69" y="10"/>
> <mx:DataGrid x="30" y="46" dataProvider="{testArr}" editable="true">
> <mx:columns>
> <mx:DataGridColumn headerText="Column 1" dataField="First"/>
> <mx:DataGridColumn headerText="Column 2" dataField="Second"/>
> <mx:DataGridColumn headerText="Column 3" dataField="Third"/>
> </mx:columns>
> </mx:DataGrid>
> <mx:DataGrid x="30" y="219" dataProvider="{testArr}" editable="true">
> <mx:columns>
> <mx:DataGridColumn headerText="Column 1" dataField="First"/>
> <mx:DataGridColumn headerText="Column 2" dataField="Second"/>
> <mx:DataGridColumn headerText="Column 3" dataField="Third"/>
> </mx:columns>
>
> </mx:DataGrid>
>
> <mx:Button click="appComplete()" label="bindtest" x="215" y="8"/>
>
> </mx:Application>
>
> And also please see the attached document for other references
>
> Regards,
> Pradeep
>
> On Wed, Nov 18, 2009 at 1:07 AM, Kiran Kumar Vasireddy
> <[email protected]>wrote:
>
> > Could you please attach the code you have to look into it? ( which changes
> > datagrid 2 when we change datagrid 1)
>
> > On Tue, Nov 17, 2009 at 8:32 AM, pradeep gorijavolu <
> > [email protected]> wrote:
>
> >> Thanx Kiran,
>
> >> i was tried wht u told to me but here like i was decalred arraycollection
> >> without bindable
>
> >> 1)in the preintialize event call the initapp() and arraycollection will
> >> place the values and displays in to the two datagrid components
> >> 2)But whn we change the values in the one datagrid it wll effect in to
> >> other datagrid also
> >> so this wll occur at run time without bindable .
>
> >> For understanding please go through this code
> >> preinitialize="initApp()"
>
> >> private var testArr:ArrayCollection;
>
> >> So please let me know how it works
>
> >> Regards,
> >> Pradeep
>
> >> On Tue, Nov 17, 2009 at 10:33 AM, Rashmi Mirajkar <[email protected]
> >> > wrote:
>
> >>> chage declaration to
>
> >>> [Bindable]
> >>> public var testArr:ArrayCollection;
>
> >>> On Tue, Nov 17, 2009 at 1:43 AM, Kiran Kumar Vasireddy
> >>> <[email protected]> wrote:
> >>> > Hi Pradeep,
>
> >>> > For String and also for arraycollection data binding is not working .
> >>> You
> >>> > are getting "Pradeep" string since you initialized it where the
> >>> variable is
> >>> > declared , try changing the value to some thing in the function still
> >>> it
> >>> > displays "Pradeep" .
>
> >>> > In the following example application is created in the followings steps
>
> >>> > 1) Created text variable and assigned value to it
> >>> > 2) Created label text and datagrid and assigned values to them
> >>> > 3) Called initApp, since initApp is called after the data grid is
> >>> created
> >>> > you are not getting any values. try calling this method like this
> >>> > preinitialize="initApp()". You will get whatever you want .
>
> >>> > So no data binding is done here in either case
>
> >>> > Hope you are clear
>
> >>> > regards
> >>> > Kiran
>
> >>> > On Thu, Nov 12, 2009 at 10:33 PM, pradeepflex <
> >>> [email protected]>
> >>> > wrote:
>
> >>> >> Hello Friends,
>
> >>> >> Please observe this code
>
> >>> >> <mx:Script>
> >>> >> <![CDATA[
> >>> >> import mx.collections.ArrayCollection;
>
> >>> >> private var testArr:ArrayCollection;
> >>> >> private var text:String = "pradeep";
> >>> >> public function initApp():void{
>
> >>> >> testArr = new
> >>> >> ArrayCollection([{First:'1',Second:'2',Third:'3'}]);
> >>> >> }
> >>> >> ]]>
> >>> >> </mx:Script>
> >>> >> <mx:Label text="{text}"/>
> >>> >> <mx:Text text="{text}" x="69" y="10"/>
> >>> >> <mx:DataGrid x="30" y="46" dataProvider="{testArr}"
> >>> >> editable="true">
> >>> >> <mx:columns>
> >>> >> <mx:DataGridColumn headerText="Column 1"
> >>> >> dataField="First"/>
> >>> >> <mx:DataGridColumn headerText="Column 2"
> >>> >> dataField="Second"/>
> >>> >> <mx:DataGridColumn headerText="Column 3"
> >>> >> dataField="Third"/>
> >>> >> </mx:columns>
> >>> >> </mx:DataGrid>
>
> >>> >> In this code without bindable also the string component can bind the
> >>> >> value into label and text component.
>
> >>> >> incase os datagrid it wll not bind and doesn't display the value
>
> >>> >> Please tel me the bottom lins of this mechanism.
>
> >>> >> Regards,
> >>> >> Pradeep.
>
> >>> >> --
>
> >>> >> You received this message because you are subscribed to the Google
> >>> Groups
> >>> >> "Flex India Community" group.
> >>> >> To post to this group, send email to [email protected].
> >>> >> To unsubscribe from this group, send email to
> >>> >> [email protected]<flex_india%[email protected]>
> >>> .
> >>> >> For more options, visit this group at
> >>> >>http://groups.google.com/group/flex_india?hl=.
>
> >>> > --
>
> >>> > You received this message because you are subscribed to the Google
> >>> Groups
> >>> > "Flex India Community" group.
> >>> > To post to this group, send email to [email protected].
> >>> > To unsubscribe from this group, send email to
> >>> > [email protected]<flex_india%[email protected]>
> >>> .
> >>> > For more options, visit this group at
> >>> >http://groups.google.com/group/flex_india?hl=.
>
> >>> --
>
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Flex India Community" group.
> >>> To post to this group, send email to [email protected].
> >>> To unsubscribe from this group, send email to
> >>> [email protected]<flex_india%[email protected]>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/flex_india?hl=.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Flex India Community" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]<flex_india%[email protected]>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/flex_india?hl=.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Flex India Community" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<flex_india%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/flex_india?hl=.
>
>
>
> binding issue.doc
> 313KViewDownload
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=.