Blazor Grid Summaries

    The Blazor IgbGrid has a summaries feature that functions on a per-column level as group footer. Blazor grid summaries is powerful feature which enables the user to see column information in a separate container with a predefined set of default summary items, depending on the type of data within the column or by implementing a custom angular template in the IgbGrid.

    Blazor Grid Summaries Overview Example

    [!Note] The summary of the column is a function of all column values, unless filtering is applied, then the summary of the column will be function of the filtered result values

    IgbGrid summaries can also be enabled on a per-column level in Ignite UI for Blazor, which means that you can activate it only for columns that you need. IgbGrid summaries gives you a predefined set of default summaries, depending on the type of data in the column, so that you can save some time:

    For string and boolean DataType, the following function is available:

    • Count

    For number, currency and percent data types, the following functions are available:

    • Count
    • Min
    • Max
    • Average
    • Sum

    For date data type, the following functions are available:

    • Count
    • Earliest
    • Latest

    All available column data types could be found in the official Column types topic.

    IgbGrid summaries are enabled per-column by setting HasSummary property to true. It is also important to keep in mind that the summaries for each column are resolved according to the column data type. In the IgbGrid the default column data type is string, so if you want number or date specific summaries you should specify the DataType property as number or date. Note that the summary values will be displayed localized, according to the grid Locale and column PipeArgs.

            <IgbColumn Field="EmployeeID" DataType="GridColumnDataType.Number" HasSummary="true"></IgbColumn>
            <IgbColumn Field="FirstName" HasSummary="true"></IgbColumn>
            <IgbColumn Field="LastName" HasSummary="true"></IgbColumn>
            <IgbColumn Field="Title" HasSummary="true"></IgbColumn>

    The other way to enable/disable summaries for a specific column or a list of columns is to use the public method EnableSummaries/DisableSummaries of the IgbGrid.

     <IgbGrid @ref=grid Id="grid" AutoGenerate="false">
            <IgbColumn Field="EmployeeID" DataType="GridColumnDataType.Number" HasSummary="true"></IgbColumn>
            <IgbColumn Field="FirstName" Sortable="true" HasSummary="true"></IgbColumn>
            <IgbColumn Field="LastName" Sortable="false" DisablePinning="true" DisableHiding="true" HasSummary="true"></IgbColumn>
            <IgbColumn Field="Title" Sortable="true" DisablePinning="false" DisableHiding="true"></IgbColumn>
    @code {
        public async void DisableSummaries()
            object[] disabledSummaries = { "EmployeeID" };
            await this.grid.DisableSummariesAsync(disabledSummaries);

    Custom Grid Summaries

    Summary Template

    Summary targets the column summary providing as a context the column summary results.

    <IgbColumn HasSummary="true" SummaryTemplateScript="SummaryTemplate">
    igRegisterScript("SummaryTemplate", (ctx) => {
        var html = window.igTemplating.html;
        return html`<div>
        <span> ${ctx.$implicit[0].label} - ${ctx.$implicit[0].summaryResult} </span>
    }, false);

    When a default summary is defined, the height of the summary area is calculated by design depending on the column with the largest number of summaries and the display density of the grid. Use the SummaryRowHeight input property to override the default value. As an argument it expects a number value, and setting a falsy value will trigger the default sizing behavior of the grid footer.

    Formatting summaries

    By default, summary results, produced by the built-in summary operands, are localized and formatted according to the grid Locale and column PipeArgs. When using custom operands, the Locale and PipeArgs are not applied. If you want to change the default appearance of the summary results, you may format them using the SummaryFormatter property.

    <IgbColumn HasSummary="true" SummaryFormatterScript="SummaryFormatter"/>
    igRegisterScript("SummaryFormatter", (summary, summaryOperand) => {
        return summary.summaryResult + " rows";
    }, false);

    Summaries with Group By

    When you have grouped by columns, the IgbGrid allows you to change the summary position and calculation mode using the SummaryCalculationMode and SummaryPosition properties. Along with these two properties the IgbGrid exposes and ShowSummaryOnCollapse property which allows you to determine whether the summary row stays visible when the group row that refers to is collapsed.

    The available values of the SummaryCalculationMode property are:

    • RootLevelOnly - Summaries are calculated only for the root level.
    • ChildLevelsOnly - Summaries are calculated only for the child levels.
    • RootAndChildLevels - Summaries are calculated for both root and child levels. This is the default value.

    The available values of the SummaryPosition property are:

    • Top - The summary row appears before the group by row children.
    • Bottom - The summary row appears after the group by row children. This is the default value.

    The ShowSummaryOnCollapse property is boolean. Its default value is set to false, which means that the summary row would be hidden when the group row is collapsed. If the property is set to true the summary row stays visible when group row is collapsed.

    [!Note] The SummaryPosition property applies only for the child level summaries. The root level summaries appear always fixed at the bottom of the IgbGrid.


    Keyboard Navigation

    The summary rows can be navigated with the following keyboard interactions:

    • UP - navigates one cell up.
    • DOWN - navigates one cell down.
    • LEFT - navigates one cell left.
    • RIGHT - navigates one cell right.
    • CTRL + LEFT or HOME - navigates to the leftmost cell.
    • CTRL + RIGHT or END - navigates to the rightmost cell.

    API References

    Additional Resources

    Our community is active and always welcoming to new ideas.