Abdul,

The array is being returned directly from Java code. I cannot use this
notation in a Java object: {Name:"Dhiren", Age:20}. I am not
explicitly creating the array in ActionScript, it is being evaluated
automatically.

BTW, what does this signify? I ran your example and see that Name:
shows up on the column header. Can you point me to some documentation
regarding this notation?

On 4/22/05, Abdul Qabiz <[EMAIL PROTECTED]> wrote:
> 
> Hey Dhiren,
> 
> Folling is simple example, where you can switch dataProvider of datagrid to
> two different Arrays with different structure of objects..One with two
> properties and other with three...
> 
> -abdul
> 
> ##DynamicDataGrid.mxml##
> 
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
> creationComplete="onAppInit()">
>    <mx:Script>
>        <![CDATA[
> 
>            var dp1:Array;
>            var dp2:Array;
> 
>            function onAppInit()
>            {
>                dp1 = [
>                        {Name:"Dhiren", Age:20},
>                        {Name:"Abdul", Age:100}
> 
>                     ];
> 
>                dp2 =   [
>                            {Subject:"Physics", Marks:95, Rank:2},
>                            {Subject:"Maths", Marks:98, Rank:1}
>                        ];
> 
>            }
> 
>            function changeDP(which:Array)
>            {
>                dg.removeAllColumns();
>                dg.dataProvider = which;
>            }
> 
>        ]]>
>    </mx:Script>
> 
>    <mx:DataGrid id="dg" />
>    <mx:Button label="Set dataProvider = dp1" click="changeDP(dp1)" />
>    <mx:Button label="Set dataProvider = dp2" click="changeDP(dp2)" />
> </mx:Application>
> 
> 
> -abdul
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
> Sent: Saturday, April 23, 2005 11:05 AM
> To: [email protected]
> Subject: RE: [flexcoders] Dymanic data/headers for DataGrid
> 
> What do you mean by 2d Object array?
> 
> Does your array look like this:
> 
> var dp =        [
>                        {Name:"Dhiren", Age:20},
>                        {Name:"Abdul", Age:23}
>                ];
> 
> -abdul
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
> Sent: Saturday, April 23, 2005 10:34 AM
> To: [email protected]
> Subject: [flexcoders] Dymanic data/headers for DataGrid
> 
> Hi guys,
> 
> I'm sure this question has been asked before, however I can't find a
> suitable answer searching the forum.
> 
> What's the best way to display dynamic data resulting from a remote
> object in a DataGrid. I have no way of knowing the headers or the
> data which will result. I have it as follows now:
> 
> <mx:DataGrid id="dg3" dataProvider="{my_list.dataValues}">
> </mx:DataGrid>
> 
> dataValues is a 2D Object array containing Strings and Doubles.
> 
> This has a few problems:
> 
> 1. The data is displayed in opposite order. i.e. col 0 is displayed
> last and col n is displayed first.
> 
> 2. I cannot display headers.
> 
> Any help would be appreciated. Thanks.
> 
> Dhiren
> 
> Yahoo! Groups Links
> 
> 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