Hi @Gaurav Kumar ,
I tried your codes but I have errors. I think,you could refer these codes.Your problem is that you need to update the pagetotal method.
You could refer to below codes:
$(document).ready(function() {
$('#example').DataTable( {
colReorder: true,
"footerCallback": function ( row, data, start, end, display ) {
var api = this.api(), data;
var currentPosition = api.colReorder.transpose( 3 );
// Remove the formatting to get integer data for summation
var intVal = function ( i ) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '')*1 :
typeof i === 'number' ?
i : 0;
};
// Total over all pages
total = api
.column( currentPosition )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Total over this page
pageTotal = api
.column( currentPosition, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Update footer
$( api.column( currentPosition ).footer() ).html(
pageTotal +' ('+ total +' total)'
);
}
} );
} );
Best regards,
Yijing Sun
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.