stop rounding
stop rounding
rldean1
Posts: 141Questions: 66Answers: 1
How do I stop Datatables from rounding?
I've encountered a column with decimal(38,30)
... 38 total spaces, with a possibility of 30 spaces to the right of the decimal.
1.012345678901234567890
-- I would prefer to display the raw value
1.0123456789012346
-- not the rounded value.
Do I use render
to make it like I want it? Do I set the column's datatype somehow?
However, if it's zeros, I'm cool with dropping those.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
That's more a Javascript limitation than a Datatables limit. Go to your browser's console and paste
1.012345678901234567890
. The result will be1.0123456789012346
.One option to display the raw value is to return the value as text. You can then convert it, in Javascript, to a floating point number if you need to do calculations. I believe the precision is around 20 digits.
Kevin