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);
})
Updated 03-02-2023
intapiuser
Admin
Joined December 15, 2022