Numerical alignment
Numerical alignment
badler
Posts: 1Questions: 1Answers: 0
I'd like to use datatables to present some statistics. There will be multiple columns of numbers with a wide range of values, and I'm looking to align numbers in the same column horizontally, so their decimal point aligns. Essentially what's asked at https://stackoverflow.com/questions/1363239/:
I haven't seen any example showing support for this. Is this possible?
Thanks!
Ben
Answers
I think that would be tough to workout a solution. See this thread. One option might be to use a number renderer and force all numbers to have the same number of decimal places. Might not work for your requirements though.
Kevin
There was a specific CSS proposal to be able to do exactly this sort of things, but I'm damned if I can remember the name of it at the moment. It never got any traction and browser's didn't implement it.
The way to do it is to split the number up - e.g.
Probably add some classes, then use CSS and flex box to align everything.
It would be possible to wrap it up into a rendering function. That would be a good one for a blog post... I'll write that up once I've finished my current tasks (so probably towards the end Nov).
Allan