I second this question or request. It would be very nice to a row-wise or even cell-wise numeric formatting in DataTable.
As for your question,
I believe your code does not work because there is no such thing as "numberFormat". In my understanding, style_data_conditional simply applies a CSS property to the generated HTML when the if-condition is satisfied. For example, textAlign becomes the text-align CSS property (god only knows why Dash team went for camelCase instead of hyphenation, perhaps they did not know the difference between hyphens and dashes and did not want to dash Dash syntax with more dashes).
@avm23, you are correct that it’s not possible to use row-wise conditional formatting to format numbers in the DataTable. However it’s possible with Dash AG Grid.
See the Dash docs:
For an example of formatting numbers by row, see the last example on this page:
Thanks, @AnnMarieW ! Your example is very pretty and to-the-point, and I will use it if I have no other choice. (Because I’d rather avoid writing Javascript functions when a specifier like 10,.4~f should do the job)
Unfortunately, it seems that AG Grid also uses an asymmetric model, in which columns and rows are entities of different kind, and only columns can be assigned a format or a formatter. This asymmetry makes transposing a table for display purposes a very difficult operation (if at all possible!).
I don’t believe this is on the radar, so it’s not likely to happen in the near future. I remember seeing this raised a few years ago but I can’t find the issue. You could try opening a feature request in the GitHub issues – or take Dash AG Grid for a spin
Hi @AnnMarieW! Thank you for your quick response.
or can DataTable be rendered from left to right with headers on left side? not as usual from top to bottom, where headers are at the top. asking just in case)