Filtering in React Data Grid

The Syncfusion® React Data Grid component provides robust filtering capabilities to display only data that meets specified conditions. This functionality simplifies the review of large datasets, enabling efficient analysis and decision-making.

Enable filtering

The Data Grid component supports filtering by setting the filterSettings.enabled property to true. This configuration displays filter bars in each column header, allowing data input to filter records based on specified conditions.

Loading...

Initial filtering

The Data Grid component supports initial filtering through the filterSettings.columns property, which automatically applies filters when the grid loads. The multiple filters can be configured across different columns by specifying each filter with its corresponding column field, a logical operator (e.g., equal, contains), and a matching value.

Loading...

Diacritics filtering

By default, the grid treats accented characters as distinct during filtering. Setting the filterSettings.ignoreAccent property as true to enables the ignore accents, treating characters like "José" and "Jose" as identical. This configuration normalizes name-based or regional data with accent marks, ensuring consistent filtering results.

Loading...

Case-sensitive filtering

By default, the grid ignores case-sensitive during filtering. Configure filterSettings.caseSensitive as true to treat uppercase and lowercase values as different. This approach proves valuable when exact matches are required.

Loading...

Filter operators

Filters use logical operators to evaluate input values against grid data. Each operator performs a distinct comparison and is applicable only to compatible data types.

OperatorDescriptionSupported Data Types
startsWithMatches values starting with the input.String
endsWithMatches values ending with the input.String
containsMatches values containing the input.String
doesNotStartWithExcludes values starting with the input.String
doesNotEndWithExcludes values ending with the input.String
doesNotContainExcludes values containing the input.String
equalMatches exact values.String, Number, Boolean, Date
notEqualExcludes exact values.String, Number, Boolean, Date
greaterThanMatches values above the input.Number, Date
greaterThanOrEqualMatches values above or equal to the input.Number, Date
lessThanMatches values below the input.Number, Date
lessThanOrEqualMatches values below or equal to the input.Number, Date
isNullShows null values.String, Number, Date
isNotNullShows non-null values.String, Number, Date
isEmptyShows empty strings.String
isNotEmptyShows non-empty strings.String
betweenMatches values in a range.Number, Date
inMatches any of the listed values.String, Number, Date
notInExcludes listed values.String, Number, Date

Wildcard filtering

The Wildcard filter can process one or more search patterns using the "*" symbol to retrieve values matching the specified patterns.

ExampleDescription
Tom*LeeMatches any string that starts with "Tom" and ends with "Lee", with any characters (or none) between them.
Tom*Matches any string that starts with "Tom", followed by any characters (or none).
*LeeMatches any string that ends with "Lee", with any characters (or none) before it.
*TomMatches any string containing "Tom", with any characters (or none) before or after it.
TomLee*Matches any string containing "Tom" followed by "Lee", with any characters (or none) before, between, or after them.

LIKE filtering

The LIKE filter can process single search patterns using the "%" symbol to retrieve values matching the specified patterns. The LIKE filtering is supported only for columns with string data types.

ExampleDescription
%Tom Lee%Returns all values that contain the phrase "Tom Lee".
Tom Lee%Returns all values that end with the phrase "Tom Lee".
%Tom LeeReturns all values that start with the phrase "Tom Lee".

The Wildcard and LIKE filter operators filters the value based on the given string pattern, and they apply to string-type columns.

Prevent filtering for particular column

To prevent filtering on a specific column, set the allowFilter property to false in that column’s configuration. This configuration prevents the filter bar from appearing for the specified column, while other columns remain filterable.

Loading...

Programmatic filtering

The Data Grid component supports applying and clearing filters programmatically through the following methods:

  • filterByColumn(field, operator, value) - Apply filters by specifying the column name (field), filter operator (operator), and filter value (value).

  • clearFilter() - Remove all filters from the grid. To clear filters on specific columns only, pass an array of column names to the method, for example: "clearFilter([columnName1, columnName2])".

Loading...

Events

The Data Grid component provides event hooks that activate when a filtering action is completed, enabling customized data processing.

EventDescription
onFilterFires after a filtering or clear filtering action completes. It provides details about the current filter state, including the "column name", "value", "action" performed (filtering or clearing). This event is useful for executing additional logic or updates once filters are applied or removed.
Loading...

See also