I want to display the total value of the items being shown in a jqGrid on my page. The only way I can think to do that is to have the server return it with the grid data, but not sure how to intercept it upon its arrival having been requested by jqGrid.
Asked
Active
Viewed 809 times
4
-
Could you explain more clear two things: 1) what do you exactly mean under "total value of the items"? 2) where you want display the information? For example you can use the place for `"View 1 - 10 of 32"` (typically displayed bottom right) or you want to use the footer/summary row (see the picture in the middle of [the page](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:how_it_works)). – Oleg Nov 01 '11 at 17:40
-
Sorry for delayed response! `Total value of the items`: Each line has a weight and number of boxes on it, I want totals of those (for all grid data) to be displayed in the footer row for example - or anywhere really, because i can manipulate it myself once its been received by the grid – Jimbo Nov 10 '11 at 12:59
-
In any way you can fill the footer contain manually with any data. You can use `footerData` inside of `loadComplete`. See [here](http://stackoverflow.com/questions/7392987/jqgrid-total-amount-row/7393740#7393740) and [here](http://stackoverflow.com/questions/5121350/jqgrid-access-cell-data-while-it-is-being-edited/5129908#5129908) – Oleg Nov 10 '11 at 14:45
1 Answers
3
You can use userdata
.
Add userdata
to your server's JSON response:
{"total":"","page":"","records":"","rows":[],"userdata":{"custom_field":"custom_value"}}
And then you can get the value of custom_field
inside your tables loadComplete
function:
custom_value = $('#table_id').getGridParam('userData').custom_field;

Artem Kalinchuk
- 6,502
- 7
- 43
- 57