I want to create different summaries on different group levels in an jqGrid, like this:
Image is based on this demo: http://www.guriddo.net/demo/guriddojs/grouping/multiple_columns/index.html
On the top level group I would like jqGrid to calculate an average and on the lower level groups it would calculate a sum.
Is this possible in jqGrid?
The main problem which I see: you need to use different
summaryType
("sum"
and"avg"
) on different levels of the grid. There are no simple way to implement this. I think it's possible, but the code will be not simple. The code can depends on version of jqGrid, which you use and from the fork (free jqGrid, Guriddo jqGrid JS of some old version <=4.7).To place result in header is easy you need just add
groupSummaryPos: ["header", "header"]
property ingroupingView
. You should set eithersummaryType: "sum"
orsummaryType: "avg"
in the columnFreight
.UPDATE: I implemented new feature in free jqGrid. Now one can use
summaryType
andsummaryTpl
defined as arrays. The demo have Total column defined asThe results of the demo looks like on the picture:
I have to remark, that the changes are not included in free jqGrid 4.10.0, which I published today, so you have to use the sources from GitHub to be able to use the feature.