DxListBox<TData, TValue>.ClearFilter() Method
Clears the filter applied to list box data.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public void ClearFilter()
Remarks
You can use the SetFilterCriteria(CriteriaOperator) method to apply filter criteria to List Box data. To clear filter, use the ClearFilter
method.
The following code creates a toolbar that allows you to apply filter criteria to List Box data and clear filter:
<DxToolbar ItemClick="@OnItemClick">
<Items>
<DxToolbarItem Name="_setFilterCriteria" Text="Set Filter Criteria" Tooltip="Set Filter Criteria" />
<DxToolbarItem Name="_clearFilterCriteria" Text="Clear Filter Criteria" Tooltip="Clear Filter Criteria" />
</Items>
</DxToolbar>
<br/>
<DxListBox @ref="@_listBox" TData=Person TValue=Person Data="Staff.DataSource"
ShowCheckboxes="true"
SelectionMode="@ListBoxSelectionMode.Multiple">
<Columns>
<DxListEditorColumn FieldName="FirstName"></DxListEditorColumn>
<DxListEditorColumn FieldName="LastName"></DxListEditorColumn>
<DxListEditorColumn FieldName="Department"></DxListEditorColumn>
<DxListEditorColumn FieldName="Salary"></DxListEditorColumn>
</Columns>
</DxListBox>
<p class="cw-480 mt-3">
Filter Criteria: <b>@_listBox?.GetFilterCriteria()?.ToString()</b>
</p>
@code {
IListBox<Person, Person> _listBox;
void OnItemClick(ToolbarItemClickEventArgs e) {
switch(e.ItemName) {
case "_setFilterCriteria":
_listBox.SetFilterCriteria(new BinaryOperator(nameof(Person.Salary), 2000, BinaryOperatorType.Greater));
break;
case "_clearFilterCriteria":
_listBox.ClearFilter();
break;
}
}
}
Implements
See Also