I am having some difficulty rendering percentages in the DataGrid. I have the following JSON file structure:
When I import these values into the DataGrid, there is a problem when I try to sort the percentage columns. The percentages are not sorted in the correct order, resulting in something like this:
So, I tried changing the JSON file to:
However, now I am having problems getting Flex to display a percentage symbol next to the numbers in the DataGrid. Any idea what I need to do to get this working? What is the right approach to take when working with number formatting in the DataGrid? Should I be formatting the numbers inside the data source before feeding into Flex, or should I be storing the raw numbers in the JSON file and then formatting them with Flex?
Great if someone can point me in the right direction, because I really can't find any information about it anywhere on the Internet.
have a look at the sortCompareFunction property of DataGridColumn. This function allows you to define you custom sorting implementation is meant exactly for these kind of scenarios. Flex Builder help and web has examples of this.