I would use labelFunction
function getLName(obj:Object, col:DataGridColumn):String
{
return obj.COLUMN.(@NAME=="LNAME")
}
<mx:DataGrid id="dg" initialize="dg.dataProvider=myxml..row" />
<mx:DataGridColumn dataField="foo" labelFunction="getLName"
headerText="Last Name">
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of yenog
Sent: Friday, October 26, 2007 9:16 PM
To: [email protected]
Subject: [flexcoders] Datagrid - Parsing Complex XML as dataprovider
Hi,
We have complex XML coming from a legacy system as a dataprovider that
we are then trying to use in a datagrid.
This is what the XML looks like;
<APPLICATION>
<LIST>
<ROW ID=1Q-258FA>
<COLUMN NAME=LNAME>Smith</COLUMN>
<COLUMN NAME=FNAME>John</COLUMN>
</ROW>
<ROW ID=1Q-258FB>
<COLUMN NAME=LNAME>Doe</COLUMN>
<COLUMN NAME=FNAME>Jane</COLUMN>
</ROW>
<ROW ID=1Q-258FC>
<COLUMN NAME=LNAME>Parker</COLUMN>
<COLUMN NAME=FNAME>Peter</COLUMN>
</ROW>
</LIST>
</APPLICATION>
The way we want the datagrid to display is in the following order;
Row Id - Last Name - First Name
1Q-258FA Smith John
1Q-258FB Doe Jane
1Q-258FC Parker Peter
I've been struggling all afternoon but havnt been able to make the
datagrid display it. If someone already has a code snippet that does
this or has some pseudo-code tips please share.
We're being able to get the XML message and parse it in an
ActionScript but cannot get it to show up in a datagrid in the form we
want. Any pointers will be highly appreciated.
Thanks