Skip to main content

GridColumnGroupFooterTemplateContext Class

Stores information about a group footer cell in the Grid and is passed as the context parameter to the DxGrid.ColumnGroupFooterTemplate and DxGridColumn.GroupFooterTemplate properties.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

Declaration

public class GridColumnGroupFooterTemplateContext

Remarks

The DxGrid.ColumnGroupFooterTemplate and DxGridColumn.GroupFooterTemplate accept a GridColumnGroupFooterTemplateContext object as the context parameter. You can use the parameter’s members to get information about the current group footer cell.

The example below makes all group summary values bold.

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable

<DxGrid Data="@Data" ShowGroupPanel="true">
    <Columns>
        <DxGridDataColumn FieldName="Country" GroupIndex="0" />
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate" GroupIndex="1" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="150px" />
        <DxGridDataColumn FieldName="Quantity" />
    </Columns>
    <ColumnGroupFooterTemplate>
        @{
            var summaryItems = context.SummaryItems;
            if (summaryItems.Any()) {
                foreach (var i in summaryItems) {
                    @context.Grid.GetGroupSummaryLabel(i, context.GroupRowVisibleIndex)
                    <text>: </text>
                    <b>@context.Grid.GetGroupSummaryFormattedValue(i, context.GroupRowVisibleIndex)</b><br />
                }
            }
        }
    </ColumnGroupFooterTemplate>
    <TotalSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="UnitPrice" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Min" FieldName="UnitPrice" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Quantity" />
    </TotalSummary>
    <GroupSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="UnitPrice" FooterColumnName="UnitPrice" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Min" FieldName="UnitPrice" FooterColumnName="UnitPrice" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Quantity" FooterColumnName="Quantity" />
    </GroupSummary>
</DxGrid>

@code {
    object Data { get; set; }
    NorthwindContext Northwind { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Data = Northwind.Invoices
            .ToList();
    }

    public void Dispose() {
        Northwind?.Dispose();
    }

}

Blazor Grid - Column Group Footer Template

Inheritance

Object
GridColumnGroupFooterTemplateContext
See Also