DxTreeList.ClearFilter() Method
Clears the filter applied to TreeList data.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public void ClearFilter()
Remarks
The TreeList applies a filter if any of the following includes filter conditions:
- The filter row. To display it, set the ShowFilterRow property to
true
. - The FilterBy method or a column’s FilterRowValue property.
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