Skip to main content

DxGridCommandColumn.FilterRowCellTemplate Property

Specifies a template used to display the command column’s filter row cell.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public RenderFragment<GridCommandColumnFilterRowCellTemplateContext> FilterRowCellTemplate { get; set; }

Property Value

Type Description
RenderFragment<GridCommandColumnFilterRowCellTemplateContext>

A template for the command column’s filter row cell.

Remarks

The command column displays predefined New, Edit, and Delete command buttons for data rows in display mode. In EditRow and EditCell edit modes, this column displays Save and Cancel buttons for the edited row. In the filter row, the column displays the Clear button.

Blazor Grid Command Column

Read Tutorial: Edit Data in Blazor Grid Read Tutorial: Filter Row in Blazor Grid

Define the FilterRowCellTemplate to display custom content in the command column’s filter row cell. The template accepts a GridDataColumnFilterRowCellTemplateContext object as the context parameter. You can use this parameter to access CommandColumn and Grid objects and obtain information about their states.

The following example displays the custom Clear button in the command column’s filter row cell. The button’s click handler calls the ClearFilter() method.

Blazor Grid Filter Row Command Column Template

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

<DxGrid Data="@Data"
        ShowFilterRow="true"
        @ref="MyGrid">
    <Columns>
        <DxGridDataColumn FieldName="OrderId" Caption="Order ID" DisplayFormat="d"/>
        <DxGridDataColumn FieldName="OrderDate" DisplayFormat="d" />
        <DxGridDataColumn FieldName="ProductName" FilterRowValue='"Queso"'
                          FilterRowOperatorType="GridFilterRowOperatorType.Contains" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c2" />
        <DxGridDataColumn FieldName="Shipped" UnboundType="GridUnboundColumnType.Boolean"
                          UnboundExpression="[ShippedDate] <> Null" />
        <DxGridCommandColumn>
            <FilterRowCellTemplate>
                <DxButton Text="Clear" Click="ClearFilter"></DxButton>
            </FilterRowCellTemplate>
        </DxGridCommandColumn>
    </Columns>
</DxGrid>

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

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

    void ClearFilter() {
        MyGrid.ClearFilter();
    }

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

Run Demo: Data Grid - Filter Row View Example: How to implement filter operator selector

See Also