Grand Total (Sum) Row In Table With Aggregation
Apply the following script on a table with aggregation's widget script to create a row with Grand Totals.
This will be considered as just another value and may not always appear on the first page of results if results are paginated.

widget.on('processresult', function(a,b){
var totals = b.result.$$rows.reduce((arr,cur) => arr.map((val, i) => ({ data: val.data + cur[i].data })));
totals[0].data = 'Grand Total';
totals.forEach(function(i){
i.text = i.data.toString()
});
b.result.$$rows.push(totals);
})1 comment
TJT
·3 years agoIs it possible to show Grand Total only for specific columns, basically only the aggregated columns.
Thanks
TJ