KendoReact Data Grid Filtering Overview
The KendoReact Data Grid enables you to display only those Grid records which meet specified criteria.
When filtering is enabled, the Grid renders a filter row in its header. Depending on the data type of each column, the filter row displays filtering components where the user can filter string, numeric, boolean, or date data types. Each consecutive filter is added to the previous ones and reduces the subset of data.
Use React Filtering for FreeYou can use the free components from the React Filtering package in production—no sign-up or license required. Filtering is part of KendoReact, an enterprise-grade UI library with 120+ free and premium components. To test-drive premium components, start a 30-day trial.Enabling Filtering
The KendoReact Grid supports filtering in two modes:
-
Built-in State Management: The Grid manages its own filtering state internally.
-
Controlled Mode: The filtering state is externally managed by handling events and updating the state accordingly.
Using the Built-in State Management for Filtering
To enable filtering using the built-in state management mechanism, follow these steps:
- Enable the
autoProcessData
prop to allow the Grid to handle paging automatically. - Set the
filterable
prop of the Grid to render a filter row under the column headers. - Set the
defaultFilter
prop to set initial filtering for the Grid.
The following example demonstrates how to implement filtering using the built-in state management of the KendoReact Grid.
Using the Filtering in Controlled Mode
To enable numeric paging in the KendoReact Grid and use it in controlled mode, follow these steps:
- Set the
filterable
prop of the Grid to render a filter row under the column headers. - Set the
filter
option of the Grid. Filtering conditions are declared asFilterDescriptors
orCompositeFilterDescriptor
. - Handle the
onFilterChange
oronDataStateChange
event of the Grid. - Filter the data on the client using built-in methods like filterBy or
process
. The data can also be filtered on the server using event parameters.
The
filterBy
method is recommended foronFilterChange
event. Theprocess
method is recommended when using theonDataStateChange
event.
Customizing the Filter Operators
The Grid allows you also to customize the operators for the numeric
, text
, and date
filter types by using the filterOperators
property which accepts GridFilterOperators
. The Grid uses the first operator from each type as its default operator. The Boolean filter types always use the equal
operator.