render footer callback as currency
render footer callback as currency
crush123
Posts: 417Questions: 126Answers: 18
Using the example https://datatables.net/examples/advanced_init/footer_callback.html
I have 2 columns displaying the total in the footer
a code snippet is as follows....
// Update footer
$( api.column( 4 ).footer() ).html(
'Due £'+ totaldue
);
$( api.column( 5 ).footer() ).html(
'Paid £'+ totalpaid
);
Some values show a single digit after the decimal point 0- is it possible to render the callback values as currency ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Here is the function to format a number, including adding a currency label and decimal control.
$.fn.dataTable.render.number( ' ', '.', 2, ' $ ' )
example is here
https://editor.datatables.net/examples/simple/simple.html
Awesome, thanks for your quick reply.
Here is my updated snippet...