Searching in React Data Grid

The Syncfusion® React Data Grid includes a built-in search feature that efficiently filters records based on a specified search value. It helps quickly locate and display relevant data from the grid’s data source. To enable this feature, set the searchSettings.enabled property to true.

Enabling search in the Data Grid toolbar

The Data Grid component adds a search box to the grid’s toolbar, enabling quick filtering of records based on text entered in the search box. To enable this feature, add the Search item to the toolbar property.

Loading...

The Data Grid component supports programmatic search using the search method instead of the built-in search box.

  • To perform a search, call search('text') with the desired string. Matching records across all searchable columns will be displayed.

  • To clear the search, call search('') with an empty string. This resets the view and shows all records.

Loading...

By default, the search applies to all visible and invisible columns.

Initializing Data Grid with predefined search value

To render the grid with a predefined search value, set the desired search value in the searchSettings property during grid initialization. This ensures that only records matching the specified search value are displayed when the grid loads.

Configure the relevant searchSettings properties to apply the predefined search during grid initialization.

PropertyDescription
fieldsSpecifies the fields in which the search operation needs to be performed.
operatorSpecifies the operator to be used for the search operation.
valueSpecifies the value to be searched.
ignoreCaseSpecifies whether the search operation should be case-sensitive or case-insensitive. This setting is optional.
ignoreAccentWhen enabled, ignores diacritic characters or accents in text during the search operation. This setting is optional.
Loading...

Search operators

The searchSettings.operator property defines how search values are compared. By default, it uses the contains operator, which returns records that include the specified search term. The following operators are supported in searching:

OperatorDescription
startswithChecks whether a value begins with the specified value.
endswithChecks whether a value ends with the specified value.
containsChecks whether a value contains with the specified value.
wildcardUses the * symbol to define the wildcard search patterns. For example, te* matches values like "test" and "team".
likeUses the % symbol to define the LIKE search patterns. For example, %box matches values ending with "box".
equalChecks whether a value equal to the specified value.
Loading...

Search specific columns

By default, the Data Grid component searches across all visible columns. To improve performance especially in wide grids limit the search to specific columns by defining their field names in the searchSettings.fields property. This approach ensures that only the designated columns (e.g., "BookID", "Title", "Author", "Genre") are included in the search operation, ignoring all other columns regardless of visibility.

The following example demonstrates restricting the search functionality to the "BookID", "Title", "Author", and "Genre" columns using the searchSettings.fields property.

Loading...

Ignore accent while searching

Enabling the searchSettings.ignoreAccent property to true makes the search treat accented and non-accented characters as equal (for example, matching "Oxford Stréét" with "Oxford Street"). This improves search accuracy in datasets containing special characters in multiple languages.

Loading...

Retrieve searched records by external button

To get the searched records, use the grid’s getData() method. This method returns results based on active queries applied to the grid. When paging is enabled, getData() returns only the records on the current page. To retrieve all searched records without pagination limits, call getData(false).

Loading...

Events

The Data Grid component provides event hooks that trigger when a search action is completed.

EventDescription
onSearchFires after a searching operation completed on the grid. Provides search result details for post-search actions such as updating UI elements, logging, or triggering dependent logic.
Loading...