Skip to main content
All docs
V25.1
  • DxTreeList.ClearFilter() Method

    Clears the filter applied to TreeList data.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    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.

    <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