jqGrid在不同组级别上的不同摘要 [英] jqGrid different summaries on different group levels
问题描述
我想在jqGrid中的不同组级别创建不同的摘要,如下所示:
图片基于此演示:
我不得不说,这些更改不包含在我今天发布的免费jqGrid 4.10.0中,所以你必须使用GitHub中的来源才能使用该功能。
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 in groupingView
. You should set either summaryType: "sum"
or summaryType: "avg"
in the column Freight
.
UPDATE: I implemented new feature in free jqGrid. Now one can use summaryType
and summaryTpl
defined as arrays. The demo have Total column defined as
{ name: "total", width: 75, template: "number",
summaryTpl: [
"<span style='color: red'>Avg: {0}</span>",
"<span style='color: DarkRed'>Sum: {0}</span>"
],
summaryType: ["avg", "sum"] },
The 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.
这篇关于jqGrid在不同组级别上的不同摘要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!