Hi,
In jqxGrid, you can calculate summaries only for the currently visible (filtered) rows by using a custom aggregates function instead of the built-in “sum” aggregate. The built-in aggregates always use the full data source.
Here’s the correct approach:
$("#grid").jqxGrid({
showstatusbar: true,
statusbarheight: 30,
showaggregates: true,
});
columns: [
{
text: 'Amount',
datafield: 'amount',
width: 150,
aggregates: [{
'Total (visible)': function (aggregatedValue, currentValue, column, record) {
// This function is called only for visible rows
return aggregatedValue + parseFloat(currentValue || 0);
}
}],
aggregatesrenderer: function (aggregates) {
return '<div style="padding: 5px; text-align: right;"><b>' +
aggregates['Total (visible)'].toFixed(2) +
'</b></div>';
}
}
]
Best regards,
Peter Stoev
jQWidgets Team
https://www.jqwidgets.com/