Hi,
The below code display the subtotal per date, but the subtotal only apply to current page. What should I amend to have a subtotal per date across all pages?
DataTables::create([
"dataSource"=>$this->dataStore("filtered_data"),
"options"=>[
"order"=> [[0, 'desc']],
"rowGroup"=>[
"startRender"=> null,
"endRender"=>"function ( rows, group ) {
var totalAuthorised = rows
.data()
.pluck(8)
.reduce( function ( a, b ) {
if ( typeof a === 'string' ) {
a = a.replace(/[^\d.-]/g, '') * 1;
}
if ( typeof b === 'string' ) {
b = b.replace(/[^\d.-]/g, '') * 1;
}
return a + b;
}, 0 );
var totalUnauthorised = rows
.data()
.pluck(9)
.reduce( function ( a, b ) {
if ( typeof a === 'string' ) {
a = a.replace(/[^\d.-]/g, '') * 1;
}
if ( typeof b === 'string' ) {
b = b.replace(/[^\d.-]/g, '') * 1;
}
return a + b;
}, 0 );
return $('<tr/>')
.append( '<td colspan=\"6\">TOTAL FOR '+group+'</td>' )
.append( '<td></td><td></td><td>'+totalAuthorised+'</td>' )
.append( '<td>'+totalUnauthorised.toFixed(0)+'</td>' )
.append( '<td></td>' );
}",
"dataSrc"=>0,
],
Thank you in advance,