[SalesForce] How to Prevent long number from being displayed in Scientific Notation in VF page

I am using JQuery datatables.net to show data in my VF page.

But , a number e.g -> 778002405501 is showing like this -> 7.78002E+11

How to prevent this and show it properly? Any idea

Best Answer

This worked:

      for (i = 0; i < records.length; i++) {
          for (j in records[i]) {
              cellValue = records[i][j]; 
              if (cellValue) {
                   if(!isNaN(cellValue)){
                      records[i][j] = Number(cellValue).toPrecision();
                   }        
              }
           }
      }

And then passing records in datatable like this: "aaData": records

Related Topic