Hardik Mishra
Hardik Mishra

Reputation: 14887

Summary in grouped row for each column - jqGrid

I am using jqGrid-4.4.1 with grouping columns.

I am able to get grouping but I do need something similar like this:

Old Version Of Grid

Sample Code for jqGrid:

$("#gridData").jqGrid({
                    colModel: colData, // col model array
                    colNames: colNamesArray, // column names array
                    data: rows, // data
                    datatype: "local", 
                    height: 'auto',
                    width: '100%',
                    viewrecords: false,
                    sortorder: "asc",
                    gridview: true,
                    grouping:true, 
                    groupingView: { 
                        groupField: ['Group'],
                        groupColumnShow: [false]
   
                    }
                   
                }

);

Currently, I have something like this: but I need comma separated values in the Grouping Row for each Column.

Web View

I have values as comma separated String. But I am not getting how it can be mapped with column

Is it possible ? Any pointers would be really great.

Upvotes: 2

Views: 3378

Answers (1)

Oleg
Oleg

Reputation: 222007

I would recommend you to use groupSummary: [true] option of groupingView to create additional summary row. One need to define summaryType property for all columns in the colModel where the summary row should be not empty and optionally summaryTpl. In the answer I shown how to create custom value in the summary row.

You can create custom grouping row like in the answer alternatively. The main reason why I recommend you to use groupSummary option of groupingView instead of creating custom is the implementation of grouping row in jqGrid. jqGrid use colspan attribute to make the grouping row spanned over all columns. What you need is summary information for every column. So the inner structure of grouping summary is better for your requirements. The only disadvantage is that the summary information will be not shown for collapsed groups.

Upvotes: 2

Related Questions