Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Customizing groupedRowTextTemplate for iggrid to include sum of non-key column


I am using a grid with groupby to display data. I have search both this forum and on the net for a solution but have not found anything that makes me able to accomplice what I am after.

My grid have a number of columns and grouping in multiple levels works as intended. One column has the field of "Amount", which is 1 or more for each data row. Using the summary functions, I can easily get the sum of "Amounts" for each group of rows.

groupedRowTextTemplate defines the text for the grouped row header and I want to alter this to include the sum value of the "Amount" column. This would allow me to show the most important information with the grouped rows collapsed.

I guess I need some jquery/JavaScript in order to make this work, but I am not sure how to do this.

I am working in MVC using the wrapper to create my grid.

/ FW

  • 180
    Offline posted

    Hello Fredrik,
    By design igGrid provides summaries within Group By feature, which can be set in columnSettings collection. This can be set via summaries option for each column. This option is a list of aggregations functions to calculate on the column values for each group. For example:

                    .Columns(column =>
                        column.For(x => x.ProductName).HeaderText("Product Name").Width("40%");
                        column.For(x => x.Rating).HeaderText("Amount").Width("60%");
                    .Features(features =>
                        features.GroupBy().Type(OpType.Remote).GroupByUrlKeyAscValue("asc").GroupByUrlKeyDescValue("desc").GroupByUrlKey("groupBy").ColumnSettings(cs =>
                            cs.ColumnSetting().ColumnKey("Amount").Summaries(gs => {
                                gs.Summary().Text("Amount sum: ").SummaryFunction(SummaryFunction.Sum);

    Please test it on your side and let me know if you need any further assistance with this matter.

    Best Regards,
    Martin Kamenov
    Associate Software Developer
    Infragistics, Inc.

  • 120
    Offline posted

    With the help from Martin Kamenov, I have found a way to achieve what I wanted. The trick was to add the summarysettings part and Summaries to the "Amount" column.


    .SummarySettings(new GroupBySummarySettings() { SummaryFormat = "#0" })



    .ColumnSettings(groupedcolumn =>



    groupedcolumn.ColumnSetting().ColumnKey("Amount").Summaries(s =>


    s.Summary().Text("total: ").SummaryFunction(SummaryFunction.Sum);

    }).GroupSummaries(gs =>






    This adds "Amount total: n" to the grouped row text, which makes the total amount visible even when the grouped row is collapsed.

    It seems to work as intended, so thanks for the help!