gosom gosom - 3 months ago 20
jQuery Question

Jquery datatables format numbers

I use the latest Datatables plugin 1.10 version.

I have 3 columns (0 , 1, 2).
Columns 1 and 2 contain numbers which should be formatted like:

1000 -> 1.000
10000 -> 10.000


I searched the documentation and I found these relevant functions:

https://datatables.net/reference/option/formatNumber

https://datatables.net/reference/option/language.thousands

Are the columns that need to be formatted detected automatically?

What is the correct usage of the above functions?

Answer

As mentioned in my comment you have to do something like this

Inside Datatable initialization :

 "aoColumnDefs": [ {
      "aTargets": [ 2 ],
    "mRender": function (data, type, full) {
     var formmatedvalue=data.replace(//regex expression)
      return formmatedvalue;
    }
}]