Reputation: 891
I have a jqGrid table that uses jqGrid 4.7.0. I have a demo here that was made by user Oleg, and I forked it to be a bit different.
Here's what happened with the demo:
I want to show a summary for OrderID and also enable grouping and collapsing (the plus and minus icons). However, as you can see, the group header by default overlapped my group summary so it doesn't show my summary for OrderID..
Is there a possible way to show the OrderID summary instead? Or in general, don't overlap the group summary with group header? I tried some tricks like display none by adding another column but that doesn't work.. I also tried making the groupText to be empty, but it still doesn't work.
groupText: []
Thanks.
Upvotes: 2
Views: 437
Reputation: 221997
You can use groupText
defined as function:
groupingView: {
groupText: [function (gv, cnt, summary) {
return summary[0].v;
}],
...
}
See http://jsfiddle.net/6zhhkbv6/1/
UPDATED: Only if you really can't update to free jqGrid and have to use old version of jqGrid (for example 4.7) then you can use the following tricky workaround:
// first subclass $.jgrid.template method
var oldJgridTemplate = $.jgrid.template;
$.jgrid.template = function (template) {
if (template !== "myDummyTemplate") {
oldJgridTemplate.apply(this, $.makeArray(arguments).slice());
}
return arguments[3][0].v;
};
...
$("#jqGrid").jqGrid({
...
groupingView: {
groupText: ["myDummyTemplate"], // dummy template
...
}
});
See the demo here: http://jsfiddle.net/OlegKi/6zhhkbv6/2/
Upvotes: 1