Определенно это можно сделать с помощью свойства labelFunction DatagridColumn.
пример:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
private var xml:XML = <userEmail>
<user firstName="john" lastName="seena" />
<user firstName="pinku" lastName="phil"/>
</userEmail>
private function getCombinedUserNameLabel(item:Object, col:DataGridColumn):String
{
return item.@firstName + " " + item.@lastName;
}
]]>
</fx:Script>
<mx:DataGrid id="monDataGrid" x="10" y="10" dataProvider="{xml.user}">
<mx:columns>
<mx:DataGridColumn width="150" headerText="User Name" labelFunction="{getCombinedUserNameLabel}"/>
</mx:columns>
</mx:DataGrid>
РЕДАКТИРОВАТЬ: массивы также не должны быть проблемой:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="application1_creationCompleteHandler(event)"
>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
private var xml:XML = <userEmail>
<user firstName="john" lastName="seena" />
<user firstName="pinku" lastName="phil"/>
</userEmail>;
private var monitoringArray:Array = [{firstName:"john", lastName:"seena"}, {firstName:"pinku", lastName:"phil"}];
private function getCombinedUserNameLabel(item:Object, col:DataGridColumn):String
{
return item.@firstName + " " + item.@lastName;
}
private function getCombinedUserNameLabel2(item:Object, col:DataGridColumn):String
{
return item.firstName + " " + item.lastName;
}
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
}
]]>
</fx:Script>
<s:VGroup>
<mx:DataGrid id="monDataGrid" x="10" y="10" dataProvider="{xml.user}">
<mx:columns>
<mx:DataGridColumn width="150" headerText="User Name" labelFunction="{getCombinedUserNameLabel}"/>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid id="monDataGrid2" x="10" y="10" dataProvider="{monitoringArray}">
<mx:columns>
<mx:DataGridColumn width="150" headerText="User Name" labelFunction="{getCombinedUserNameLabel2}"/>
</mx:columns>
</mx:DataGrid>
</s:VGroup>
</s:Application>