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
115
igx-grid summary by group
posted

When I enable summaries on a column, and I do groupings, how can I make the summary row appear for each group, instead of just the one main total at the bottom of the grid?

Also, for number data types, is there a way to specify which summaries I want?  Specifically, I want the SUM but not any of the others.  I'm not seeing that on the documentation.

Parents
No Data
Reply
  • 23953
    Offline posted

    Hello Scott,

    The Group Summaries is scheduled for 7.1.0 version, which is planned for 14 December 2018. You can check the Ignite UI for Angular Roadmap here.

    You can define which summaries you want by creating a custom class that extends IgxNumberSummaryOperand class. For example if you want only Sum summary you can define you custom class like this:

    class SumSummary extends IgxNumberSummaryOperand {
    
        constructor() {
            super();
        }
    
        operate(data?: any[]): IgxSummaryResult[] {
            var result = [];
            result.push({
                key: 'sum',
                label: 'Sum',
                summaryResult: IgxNumberSummaryOperand.sum(data)
            });
    
            return result;
        }
    }
     

    And then in the template you should define your column like this:

     

    <igx-column field="UnitsInStock" header="UnitsInStock" [summaries]="SumSummary" width="200px" [dataType]="'number'" >
    </igx-column>

    Best regards,
    Martin Pavlov
    Infragistics, Inc.

Children
No Data