You are going to need a labelFunction to do this, instead of columnName.

private function lblfArray0(oItem:Object):String {
        return oItem.colSpecData[0];
}

<mx:DataGridColumn headerText="A"
                labelFunction="lblfArray0" width="50" textAlign="left"/>

Tracy
-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Parekh, Shweta - BLS CTR
Sent: Monday, October 03, 2005 2:19 PM
To: 'flexcoders@yahoogroups.com'
Subject: [flexcoders] Populating values in datagrid from arrays

Hi,

I am having problem populating values in my datagrid. From my mxml, I
make a
remote call to my controller which returns an array of ItemVOs. 
ItemVO has one-dimensional integer array, containing values for columns
in
each row in the datagrid. i.e. if my int array in ItemVO1 contains
values 1,
2 and array in ItemVO2 contains values 3,4, then my datagrid should
display 
   1    2
   3    4 
Instead the code below displays my datagrid as 
  1,2   1,2
  3,4   3,4

Code:
<mx:RemoteObject id="itemDetailController"
source="controllers.ItemDetailController" showBusyCursor="true">
        <mx:method name="getColSpecData"
result="result_ColSpecData=event.result">
                        <mx:arguments>
                <arg1>{itemSid}</arg1>
                        <arg2>{irMonth}</arg2>
                        <arg3>{monthNo}</arg3>  
                </mx:arguments>
        </mx:method>
</mx:RemoteObject>
<mx:VBox>
          <mx:DataGrid id="colSpec_dg" width="600"
dataProvider="{result_ColSpecData}" textAlign="left" height="250"
headerHeight="50" editable="true" >
            <mx:columns>
                  <mx:Array>
                    <mx:DataGridColumn headerText="A"
columnName="colSpecData" width="50" textAlign="left"/>
                    <mx:DataGridColumn headerText="B"
columnName="colSpecData" width="100" textAlign="left"/>
                  </mx:Array>
            </mx:columns>
          </mx:DataGrid>

<mx:FormItem direction="horizontal" width="100%" height="30">
        <mx:Text text="value:" width="90"/><mx:Spacer height="63"/>
        <mx:Text id="tobEffIrm"
text="{itemDetailController.getColSpecData.result[0].colSpecData[0]}"
width="57"/><mx:Spacer height="63"/>
        <mx:Text id="tobEffIrm1"
text="{itemDetailController.getColSpecData.result[0].colSpecData[1]}"
width="57"/><mx:Spacer height="63"/>
        <mx:Text id="tobEffIrm2"
text="{itemDetailController.getColSpecData.result[1].colSpecData[0]}"
width="57"/><mx:Spacer height="63"/>
        <mx:Text id="tobEffIrm3"
text="{itemDetailController.getColSpecData.result[1].colSpecData[1]}"
width="57"/><mx:Spacer height="63"/>
</mx:FormItem>

If I replace colSpecData with colSpecData[0] and colSpecData[1],
datagrid
does not show any values. But the text field displays values fine as 1 2
3
4. 
I fail to understand why the dataprovider in the datagrid does not work
with
indexes specified. Can anybody please help me with this. 

Thanks in advance,
Shweta





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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