Formatting data in a List-based control
Table of Contents
Just as you can format data in other types of controls, you can format data in the cells of List-based controls.You can apply a formatter to a List-based control without creating a custom cell renderer.
The following figure shows a DataGrid column that uses a NumberFormatter formatter to round the numbers in the second column:

To apply a data formatter to the cells of a List-based control, you do the following:
- Declare a formatter tag in MXML; for example:
<mx:NumberFormatter id="FORMATTER" precision="1"/>
- Specify an ActionScript function as the value of a
labelFunctionproperty of a List control or DataGridColumn; for example:<mx:DataGridColumn columnName="age" headerText="age-Formatter"
labelFunction="formatAge"/ - Call the formatter's
format()method in the ActionScript function specified in thelabelFunctionproperty; for example:
function formatAge(item){
return FORMATTER.format(item.age);
}


