When displaying data in a DataGrid you can now reach into the inner structure of the data item while using the dataField property.
Let’s say your data is:
<employee>
<name>Maurice Smith</name>
<phone>555-219-2012</phone>
<email>maurice@fictitious.com</email>
<active>false</active>
<description>
<short>short description </short>
</description>
</employee>
<employee>
<name>Mary Jones</name>
<phone>555-219-2000</phone>
<email>mjones@fictitious.com</email>
<active>true</active>
<description>
<short>short description </short>
</description>
</employee>
<name>Maurice Smith</name>
<phone>555-219-2012</phone>
<email>maurice@fictitious.com</email>
<active>false</active>
<description>
<short>short description </short>
</description>
</employee>
<employee>
<name>Mary Jones</name>
<phone>555-219-2000</phone>
<email>mjones@fictitious.com</email>
<active>true</active>
<description>
<short>short description </short>
</description>
</employee>
If your data has nested fields, like the short one above you can use simple dataField to reach for them, like this:
<mx:DataGrid dataProvider="{employees}">
<mx:columns>
<mx:DataGridColumn dataField="description.short" headerText="Description"/>
</mx:columns>
</mx:DataGrid>
<mx:columns>
<mx:DataGridColumn dataField="description.short" headerText="Description"/>
</mx:columns>
</mx:DataGrid>
I’m almost sure this wasn’t possible the last time I’ve tried this with some previous version of Flex SDK.
by JabbyPanda
27 Apr 2011 at 10:42
You are right, in Flex 3.4 SDK and before DataGridColumn class was not capable to parse complex field names, now with a release of Flex 3.5 SDK it is a matter of the past days!
Search for protected property “hasComplexFieldName” and more in DataGridColumn.as
No more needed extending of DataGridColumn to achieve this functionality by ourselves!
e.g
“Nested properties and DataGridColumn”
http://cornelcreanga.com/2008/08/nested-properties-and-datagridcolumn/
“Nested Data in Flex DataGrid by Extending DataGridColumn”
http://www.switchonthecode.com/tutorials/nested-data-in-flex-datagrid-by-extending-datagridcolumn
by JabbyPanda
27 Apr 2011 at 11:50
BTW, here is related ticket open at Adobe JIRA from 2007 (!) https://bugs.adobe.com/jira/browse/SDK-9801,
Fixed by community in 2009, but sorting for the complex field is broken in current SDK code
http://bugs.adobe.com/jira/browse/SDK-23643
Possible workaround for this issue from Brian Kotek:
“Flex DataGridColumn Complex Properties Bug and Workaround”
http://www.briankotek.com/blog/index.cfm/2009/10/9/Flex-DataGridColumn-Complex-Properties-Bug-and-Workaround