Blazor Grid - Filters

Use Blazor Bootstrap grid component to display tabular data from the data source. And it supports client-side and server-side filtering, paging, and sorting.

Client side filtering#

For filtering, AllowFiltering and PropertyName parameters are required.
Add AllowFiltering="true" parameter to Grid and PropertyName parameter to all the GridColumns.

Client side filtering with StringComparision#

In the below example, StringComparision.Ordinal is used on the Employee Name column to make the filter case-sensitive.
IMPORTANT
By default, StringComparison.OrdinalIgnoreCase is used to compare culture-agnostic and case-insensitive string matching.

Set default filter#

FilterOperator and FilterValue parameters are required to set the default filter.
TIP
You can set the default filter on more than one GridColumn.
The default sorting is enabled on the Id column in the below example.

Disable specific column filter#

Filterable parameter is required to disable the filter on a specific column. Add Filterable="false" parameter to GridColumn. The column filter is disabled on the Id column in the below example.

Increase filter textbox width#

Add FilterTextboxWidth parameter to the GridColumn to increase or decrease the filter textbox width, FilterTextboxWidth parameter is optional.
NOTE
Filter textbox width measured in pixels.
Important

The Add Employee button click adds a new employee to the existing employees collection—so explicit grid refresh is required.

The Add Employee 2 button click creates a shallow copy of the employees collection and adds a new employee. This new collection is assigned to the employees variable. Now, the employees variable has a new reference. So the grid will refresh automatically. An explicit grid refresh call is not required.

Enum filter#

Guid filter#