DxGrid.ClearFilter() Method

Clears the filter applied to grid data.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

public void ClearFilter()

Remarks

The Grid applies a filter if any of the following includes filter conditions:

Call the ClearFilter method to clear all filter conditions.

The highlighted code block adds a button that clears filter conditions.

@using Grid.Northwind
@inject NorthwindContext Northwind

<DxGrid Data="@Data"
        ShowFilterRow="true"
        @ref="MyGrid" >
    <Columns>
        <DxGridDataColumn FieldName="OrderId" DisplayFormat="d" />
        <DxGridDataColumn FieldName="OrderDate" DisplayFormat="d" />
        <DxGridDataColumn FieldName="ProductName" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c2" />
        <DxGridDataColumn FieldName="Shipped" UnboundType="GridUnboundColumnType.Boolean"
                          UnboundExpression="[ShippedDate] <> Null">
            <CellDisplayTemplate>
                <DxCheckBox CssClass="d-inline-block" Enabled="false" Checked="(bool)context.Value" />
            </CellDisplayTemplate>
        </DxGridDataColumn>
    </Columns>
</DxGrid>

<DxButton Click="@(() => MyGrid.ClearFilter())">Clear Filter</DxButton>

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

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

Grid - Clear Filter in Code

To clear a filter condition for an individual column in code, call the FilterBy method and pass null to its value parameter.

<DxButton Click="@(() => MyGrid.FilterBy("ProductName", GridFilterRowOperatorType.Contains, null))">Clear the "Product Name" Filter Condition</DxButton>

Users can clear a filter condition in the filter row.

Implements

See Also