$.fn.dataTable.render.number() randomly rounds of decimal values to 0

$.fn.dataTable.render.number() randomly rounds of decimal values to 0

AchuAchu Posts: 1Questions: 1Answers: 0

i am trying to render using $.fn.dataTable.render.number(',','.',2) but in some scenarios the decimal gets round off to 0 where actually the number has many decimals going for it.
Code Snippet :

columns: [
{
                        
                        data: "APTS_Discount__c",
                        render: function (data, type, row) {
                            console.log('Data value ' +data);
                            
                            var render = $.fn.dataTable.render.number(currencyLocaleSeparator, demicalLocaleSeparator, 2).display(data);
                            console.log(render);
                        }                       
                                                                        
                    }]

On the console the value is showing as 85.99622086920009 as data value and 85.00 as rendered value

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Don't forget to return the value of render from the columns.render function - something like this.

    Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Colin

Sign In or Register to comment.