Skip to content

Display group summary without any detail records

Question:
When using group summary, I just want to display the report as grid WITHOUT any detail rows. The layout needs to be something like this

User name ABC : sum(of somthingl) : count(of something) 
User name XYZ : sum(of somthingl) : count(of something)
User name JOE : sum(of somthingl) : count(of something)
...


SOLUTION:
Insert the following BEFORE calling display().

$dg->add_event("jqGridLoadComplete",
    'function () {
        var i, groups = $(this).jqGrid("getGridParam", "groupingView").groups,
            l = groups.length,
            idSelectorPrefix = "#" + this.id + "ghead_0_";
        for (i = 0; i < l; i++) {
      // get grouping name
            txt = $(idSelectorPrefix + i).text();
            // copy group name to first cell in footer
            $(idSelectorPrefix + i + " ~ tr.jqfoot").first().find(">:first-child").text(txt);
            // hide the grouping non-footer row
      $(idSelectorPrefix + i).siblings().not(".jqfoot").hide();
        }
    }');

Feedback and Knowledge Base