Found this older thread below which looks like it could solve my problem if someone could just clarify a couple things for me:

I've got a result handler that decodes a json response which is a mutlidimensional array. Right now I pass the event result toString and then set the string to a new array collection like so:

private function httpsvcRH(event:ResultEvent):void {
var data:Object = JSON.decode(event.result.toString());
myArray1 = new ArrayCollection(data.fruit); }

I need fruit.name as well as grower.name, grower.id, and grower.address in the DG columns. I'm not clear, and haven't found an decent example of how to get the result data to the labelFunction functions or how I need to handle the result string differently to feed the DG.

tia/

Tim Stewart-3 wrote:
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