Last active
December 10, 2015 23:18
-
-
Save rjattrill/4508160 to your computer and use it in GitHub Desktop.
Format numbers in Spark DataGrid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fx:Script><![CDATA[ | |
import spark.formatters.NumberFormatter; | |
var numberFormatter:NumberFormatter = new NumberFormatter(); | |
private function numberFormat(item:Object, column:GridColumn):String { | |
return numberFormatter.format(item [column.dataField]); | |
} | |
]]> | |
</fx:Script> | |
<s:GridColumn dataField="valueNum" headerText="Value" labelFunction="numberFormat"> |
Another approach - probably simpler - is to use the 'formatter' property of the dataGrid and point it to a spark.formatter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You normally will have the labelFunction already in a base component.