You will either need to:
- translate the values in the dataprovider itself. I'm not sure if you want to do this as you will change the source of data.
- add label functions to the datagrid columns and return the translated text for each cell
Question
I have a dataprovider that is an ArrayCollection of simple string values. I need to get these strings translated before they are rendered in my datagrid. How can I do this?
Note that I do not want to copy it to a new ArrayCollection with the translated values since i allowing inline editing to update the dataprovider source.
Current datagrid without translation for values in the dataprovider
<mx:DataGrid width="100%" height="100%" id="contactInfoGrid"
dataProvider="{model.selectedCustomer.contacts}"
editable="true" itemEditEnd="contactInfoChanged(event)">
<mx:columns>
<mx:DataGridColumn width="200" dataField="type" editable="false"
headerText="{resourceManager.getString('customer','customer.contactInformation.type')}"/>
<mx:DataGridColumn width="300" dataField="value" editable="true"
headerText="{resourceManager.getString('customer','customer.contactInformation.value')}"/>
<mx:DataGridColumn editable="false" headerText="{resourceManager.getString('customer','general.remove')}">
<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center">
<controls:RemoveLinkButton visible="true" label="" click="outerDocument.removeContactInfo(event)"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
Solution
You will either need to: