My grid is using remote data with paging, sorting and filtering. I want to show a summary row without using grouping. I am using the following method in grid complete event:
var grid1 = pq.grid("div#grid_paging", obj);
function calculateSummary() {
var grd = $("div#grid_paging");
var data = grd.pqGrid('option', 'dataModel.data');
if (data.length > 0)
{
var totalSum = 0;
for (var i = 0, len = data.length; i < len; i++) {
var rowData = data;
totalSum += parseFloat(rowData["Amount"]);
}
var cm = grd.pqGrid('option', 'colModel');
var srow = [];
for (var i = 0; i < cm.length; i++) {
var column = cm;
if (column.dataIndx == "Amount") {
srow.push("Total: " + totalSum);
}
else {
srow.push("");
}
}
var sumRows = [];
sumRows.push(srow);
grd.pqGrid({ summaryData: sumRows });
grid1.refresh();
}
}
It is showing an empty summary row.