New to Telerik UI for Blazor? Download free 30-day trial

Grid Filtering Overview

The Grid component offers built-in support for filtering.

Basics

To enable filtering, set the grid's FilterMode property to one of the following values:

The behavior of the filter input and the available filter operators will depend on the column data type. For example, a boolean field will only have the options "is true" and "is false" and will not have operators like "contains" or "greater than".

You can filter more than one column at a time, and all filter rules will be applied together with an AND logic.

You can prevent the user from filtering a certain field by setting Filterable="false" on its column.

More Filtering Options

In addition to the two main filtering modes, the grid offers two more features that can enhance the user experience when looking for data:

  • A searchbox in the toolbar can amend the filters and let the user look up many fields at once

  • The filter menu can show a list of checkboxes with the distinct values from the data to make filtering resemble Excel.

Filter Descriptors

The Grid filter state is stored in two types of filter descriptors. The below information is important if you want to get or change the Grid filters programmatically.

Custom Filtering

There are two approaches to customize the grid filtering behavior, and you can use them together:

  • Perform the data operations yourself (e.g., by outsourcing them to some API backend or other service) - to do that, use the OnRead event. This will let you fetch only the current page of data for the grid, instead of pulling the entire data set and storing it in-memory in the view-model.

  • Customize the appearance and behavior of the filters - for that, use the Filter Templates the grid provides.

Advanced Examples

The following articles and sample projects can be helpful when implementing filtering:

Notes

  • The grid uses Activator.CreateInstance<TItem>(); to get the type of the item it is bound to in order to generate proper filters and filter operators for them. Thus, the Model should have a Parameterless constructor defined.

See Also

In this article
Not finding the help you need? Improve this article