I have one question about the number formatting of numeric cells.
We need to enable the sorting on columns. And the json data we received from server has the raw value as well as the formatted text for each cell { text: $1,234, raw: 1234 }, WITHOUT the number formatting patterns.(like $0,000). The reason is a bit complex, in our table each cell’s formatting is decided by several layers, to resolve the final used formatting patten requires heavy calculation, so we put it at server side.
So I am wondering how can I achieve this:
I have the formatted text already, so actually I do not need the HOT formatting capability. I want HOT to display each cell the way I told it to.
But meantime, I have to pass the data as numeric, because if I pass it as text, the sorting goes alphabetically, not numerically.
To add more informaiton, I looked into our requirements, I find that it is even more complex, for certain cells, we need to diaply them as symbols like:
For example: “when profit is increased by 20%, then display it as a upper arrow”
So in one column we have formatted numbers as well as symbols or texts
In such a case, can we still define this column as ‘numberic’? And if yes, which numeric formatted pattern should I use to get the effect done (some are $123, some are some are ‘abc’)
If we need to define this column as ‘text’, is there a way to get it sort by the numeric data behind the displayed text/symbol?
I tried your approach, and it works well.
There is one note to make, to get the correct row, col index before sorting, you need to get the information from cellProperties parameter of the renderer.
Something like this: