blank footer row

Questionsblank footer row
caloyiv asked 10 years ago

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.

7 Answers
caloyiv answered 10 years ago

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..

Abu Ghufran answered 10 years ago

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});

caloyiv answered 10 years ago

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

Abu Ghufran answered 10 years ago

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.

caloyiv answered 10 years ago

Thank you Mr. Abu.

Abu Ghufran answered 10 years ago

Thanks for sharing.

David answered 9 years ago

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

Your Answer

20 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?