Hello Mr. Abu,
I'm trying the footer row option but the row returns blank. What seems to be the problem in my code?
pastebin –> http://pastebin.com/X5NxwUss
Thank you.
I had a mistake with this –>
$rs = mysql_fetch_assoc(mysql_query("SELECT SUM(amount) as s FROM (SELECT amount FROM remittance ORDER BY $sidx $sord LIMIT $rows) AS tmp"));
and changed it to –>
$rs = mysql_fetch_assoc(mysql_query("SELECT SUM(amount) as s FROM (SELECT amount FROM remittance ORDER BY $sidx $sord LIMIT $rows) AS tmp"));
but still it has blank row..
Hello,
I can't exactly find the issue, and code seems fine.
On line 150, try replacing field name with lower case:
grid.jqGrid('footerData','set', {Id: 'Total: ' + sum, Date: 'Sub Total: '+sum_running, Amount: 'Grand Total: '+sum_table});
to
grid.jqGrid('footerData','set', {id: 'Total: ' + sum, date: 'Sub Total: '+sum_running, amount: 'Grand Total: '+sum_table});
Thank for your prompt reply sir.
I changed it but i got this output–>
Total:41280
Subtotal: undefined
Grand Total: undefined
when I tried this–>
sum_running = grid.jqGrid('getCol', 'running_total')[0];
console.log(sum_running);
// sum of total records
sum_table = grid.jqGrid('getCol', 'table_total')[0];
console.log(sum_table);
console output –>>
undefined
undefined
This is because, the columns where you are showing footer has date formatter and currency formatter.
The grid is trying to formatter the footer row according to these formatter, causing undefined.
You can move those footer values below other columns that dont use formatter.
Another method to keep col formatter and footer row.
According to Jqgrid wiki:methods
footerData (action,data, format)
{format – default is true. This instruct the method to use the formatter (if set in colModel) when new values are set. A value of false will disable the using of formatter}
in your case:
grid.jqGrid('footerData','set', {id: 'Total: ' + sum, date: 'Sub Total: '+sum_running, amount: 'Grand Total: '+sum_table},false); //add false at last parameter
Regards