Hello Abu, I am trying to export a grid with footer row data but it simply adds the 2 hidden columns, running total & table total and omits the actual sum at bottom, is there any way around this?
Thank you
Also I cannot seem to get that actual totals to add up, the only one display is the grand total which I don't really need? On the demo there are 3 totals, I need the one on the left but it doesn't output in my grid?
Pastebin http://pastebin.com/pPVQdzPn
Thank you
When you set:
grid.jqGrid('footerData','set', {tbl_invoice_data: 'Total: '+t});
The 'tbl_invoice_data' should be the exact column name $col["name"] below which you want to show data in footer.
I see that no col exist with this name. Replace it with one of the displayed col name.
Hi Abu, I see that mistake shortly after I posted and changed but it still only outputs Grand Total
grid.jqGrid('footerData','set', {id: 'Total: ' + sum, total: 'Sub Total: '+sum_running, total: 'Grand Total: '+sum_table});
grid.jqGrid('footerData','set', {total: 'Total: '+t});
All I need is the total of displayed records [left on your demo] but think something is incorrect, when grid loads it shows 'Grand Total: undefined'
Hi Abu, I have resolved this, the id was set as hidden which also hides the Grid Total. Am I able to move the total across to the right of the grid and remove Grand Total, I have tried everything but cannot find a way to do this.
Also is it possible to export the footer with grid into pdf, currently it exports the grid with no footer and the 2 virtual columns?
Thanks
Change
grid.jqGrid('footerData','set', {id: 'Total: ' + sum, tbl_invoice_data: 'Sub Total: '+sum_running, total: 'Grand Total: '+sum_table});
to
grid.jqGrid('footerData','set', {total: Total: '+sum});
This means, after removing all other, show footer row under column 'total' with the value 'Total: <sum>'
Currently footer export is not supported. As an alternate, you can use custom pdf export and add footer row data manually.
Code: http://phpgrid.org/demo/demos/appearence/footer-row.phps – LIne 32,98,120
Live: http://phpgrid.org/demo/demos/appearence/footer-row.php
Hi Abu, thank you, the footer export function works perfectly the total is under wrong column but I guess that maybe related to the issue below, much appreciated..
I have tried grid.jqGrid('footerData','set', {total: Total: '+sum'});
which removed footer completely & also tried
grid.jqGrid('footerData','set', {id: 'Total: ' + sum, total}); which makes grid stay on load, never actually loads though..
Thank you
My last message had some quotes related issue. Let me explain again.
The notation in { } is { key: value }
Now key should be the column name, which is total.
And value will be 'Total' string concat (+) with JS variable sum which is (i guess) calculated earlier in function.
grid.jqGrid('footerData','set', {total: 'Total: '+sum});
Hi, eventually found a way to make this work by changing code as follows, adding the false to end of line fixed it..;
// 4th arg value of false will disable the using of formatter
grid.jqGrid('footerData','set', {total: 'Total:£ '+sum}, false);
Thanks
You can format is using JS.
For e.g. if 't' is variable, then to make 2 decimal places figure set:
t = t.toFixed(2);