Currently only the first page total is printed in the footer.
code used
footer:true,
exportOptions: {
modifier: {
order: 'index', // 'current', 'applied','index', 'original'
page: 'all', // 'all', 'current'
search: 'none' // 'none', 'applied', 'removed'
},
columns: [0, 1, 2, 3, 4]
}
footer call back is
footerCallback: function( tfoot, data, start, end, display ) {
var api = this.api();
var intVal = function (i) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '') * 1 :
typeof i === 'number' ?
i : 0;
};
total = api
.column(4)
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0)
pageTotal = api
.column(4, { page: 'current' })
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
$(api.column(4).footer()).html(
pageTotal + ' (' + total + ' total)'
);
}
the values displayed in the page are correct. But on print option only the first page total is displayed in the footer.