If you want to sum the values that are in jqGrid, you can do this in JavaScript (preferably in an event gridComplete):
$('#gridId').jqGrid({
...
footerrow: true,
gridComplete: function() {
var $grid = $('#gridId');
var colSum = $grid.jqGrid('getCol', '<Your column name>', false, 'sum');
$grid.jqGrid('footerData', 'set', { 'Your column name>: colSum });
}
});
If you need to calculate the amount on the server side, you must first enable the parameter userDataOnFooter:
$('#gridId').jqGrid({
...
footerrow : true,
userDataOnFooter : true
});
Then specify the amount in the server response. For example, in JSON, it should look like this:
{
total: x,
page: y,
records: z,
rows : [
...
],
userdata: { <Your column name>: <sum counted on server side> }
}
jqGrid Demos ( " 3.5", " " ).