Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxTreeList.ClearFilter() Method

Clears the filter applied to TreeList data.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public void ClearFilter()

#Remarks

The TreeList 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.

@inject EmployeeTaskService EmployeeTaskService

<DxTreeList Data="TreeListData"
            KeyFieldName="Id"
            ParentKeyFieldName="ParentId" 
            ShowFilterRow="true"
            @ref="MyTreeList">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
</DxTreeList>

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

@code {
    ITreeList MyTreeList { get; set; }
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}

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

Razor
<DxButton Click="@(() => MyTreeList.FilterBy("EmployeeName", TreeListFilterRowOperatorType.Contains, null))">
    Clear the "Employee Name" Filter Condition
</DxButton>

Users can clear a filter condition in the filter row.

See Also