Can I use maxDecimalPlaces to round a number instead of truncate.

Patrick OFriel asked 6 days ago

Hello, I have a column that should show only two decimal places and round the value when necessary.  For example, when a cell has the number ‘23.32678’, it should display ‘23.33’. Here’s an example in fiddle where it is just cutting off the extra decimal places .

Is there a simple way to accomplish what I’m looking for? 

2 answers

Christopher Phillips 6 days ago

We also noticed when importing that dataset as a CSV the values round correctly

Vera Didenko Flexmonster 5 days ago

Thank you for writing to us.
We would like to point out that maxDecimalPlaces should round the numbers.
Our team is working on this and the fix will be available in the minor release of Flexmonster with the ETA 15th of July.
As a workaround, the decimalPlaces property can be used.
The decimalPlaces parameter specifies the exact number of decimals to show after the decimal separator. 
For example, 

formats: [
{ decimalPlaces: 2}

Here is a JSFiddle example for illustration.
Please let us know if this works for you.
You are welcome to contact us in case further questions arise.
Best Regards,

Please login or Register to Submit Answer