Searching in TypeScript Treegrid control
18 Nov 20181 minute to read
You can search records in a TreeGrid, by using the search method with search key as a parameter. This also provides an option to integrate search text box in treegrid’s toolbar by adding search item to the toolbar.
To search records, inject the Filter module in the treegrid.
Initial search
To apply search at initial rendering, set the fields, operator, key, and ignoreCase in the searchSettings.
By default, treegrid searches all the bound column values. To customize this behavior define the
searchSettings.fieldsproperty.
Search operators
The search operator can be defined in the searchSettings.operator property to configure specific searching.
The following operators are supported in searching:
| Operator | Description |
|---|---|
| startsWith | Checks whether a value begins with the specified value. |
| endsWith | Checks whether a value ends with the specified value. |
| contains | Checks whether a value contains the specified value. |
| equal | Checks whether a value is equal to the specified value. |
| notEqual | Checks for values not equal to the specified value. |
By default, the
searchSettings.operatorvalue iscontains.
Search by external button
To search treegrid records from an external button, invoke the search method.
Search specific columns
By default, treegrid searches all visible columns. You can search specific columns by defining the specific column’s field names in the searchSettings.fields property.
You can refer to our
JavaScript Tree Gridfeature tour page for its groundbreaking feature representations. You can also explore our JavaScript Tree Grid exampleJavaScript Tree Grid exampleto knows how to present and manipulate data.