Skip to main content

GridColumnFooterTemplateContext Class

Stores information about a footer cell in the Grid and is passed as the context parameter to the DxGrid.ColumnFooterTemplate and DxGridColumn.FooterTemplate.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.2.dll

Declaration

public class GridColumnFooterTemplateContext

Remarks

The DxGrid.ColumnFooterTemplate and DxGridColumn.FooterTemplate accept a GridDataColumnGroupRowTemplateContext object as the context parameter. You can use the parameter’s members to get information about the current footer cell.

The example below makes all summary values bold.

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

<DxGrid Data="@Data">
    <Columns>
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="150px" />
        <DxGridDataColumn FieldName="Quantity" />
    </Columns>
    <TotalSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="UnitPrice" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Min" FieldName="UnitPrice" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Quantity" />
    </TotalSummary>
    <ColumnFooterTemplate>
        @{
            var summaryItems = context.SummaryItems;
            if (summaryItems.Any()) {
                foreach (var i in summaryItems) {
                    @context.Grid.GetTotalSummaryLabel(i)
                    <text>: </text>
                    <b>@context.Grid.GetTotalSummaryFormattedValue(i)</b> <br/>
                }
            }
        }
    </ColumnFooterTemplate>
</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 Footer Template

Inheritance

Object
GridColumnFooterTemplateContext
See Also