I have this datatable, I want to sum the column and add the result with currency format in the footer . The sum is working fine but I can't figure out how to add the curency format in the totals. Can you help me please?
footerCallback: function( tfoot, data, start, end, display ) {
var api = this.api();
$(api.column(5).footer()).html(
api.column(5).data().reduce(function ( a, b ) {
return a + b;
}, 0)
);
$(api.column(6).footer()).html(
api.column(6).data().reduce(function ( a, b ) {
return a + b;
}, 0)
);
$(api.column(7).footer()).html(
api.column(7).data().reduce(function ( a, b ) {
return a + b;
}, 0)
);
var col8 = $(api.column(8).footer()).html(
api.column(8).data().reduce(function ( a, b ) {
return a + b;
}, 0)
);
},