dataField will only accept strings, not expressions like "practice.name"
These count as strings: "@attrName", "*".

 

labelFunction is the correct solution.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tim Stewart
Sent: Sunday, February 17, 2008 4:41 PM
To: [email protected]
Subject: RE: [flexcoders] Accessing Multi Dimensional Array Collection
Data in a DataGrid

 

Hi, I too was frustratetd by this. I think it ought to work in the way
you've coded it. You can get it to work with labelFunction as follows,
but its more long-winded.

 

<mx:DataGridColumn labelFunction="practiceName"
headerText="Practice" />

 

private function labelFunction (case : Object, column : DataGridColumn)
: String {

    return case.practice.name;

}

 

Cheers, Tim

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of michaelisraelcaplan
Sent: Monday, 18 February 2008 6:06 AM
To: [email protected]
Subject: [flexcoders] Accessing Multi Dimensional Array Collection Data
in a DataGrid

Hi there,

Probably a rather straightforward solution that I am just overlooking.
I have an array collection that is acting as the data provider for a
datagrid. I have mapped out all the columns between the array
collection and the data grid with the DataGridColumn element. 
However, my array collection is multi dimensional, and I can't figure
out how to map "deeper" content to the data field. The each
collection row contains a nested array called "practice" that has
values.

How do I map my datagrid column to the "name" property of the nested
array "practice"?

<mx:DataGrid id="myCases" dataProvider="{cases}">

<mx:columns>

<mx:DataGridColumn dataField="practice.name"
headerText="Practice" />
<mx:DataGridColumn dataField="acknowledged" headerText="Ack" />

<mx:DataGridColumn dataField="id" headerText="Case" />

<mx:DataGridColumn dataField="arrival_date"
headerText="Arrival" />

</mx:columns>

</mx:DataGrid>

Thanks,

Mike

 

Reply via email to