Basic functionality

Search plugin provides an easy interface to perform data search across Handsontable. First thing you should do, is enabling the plugin by setting the searchoption to true. When enabled, searchPluginexposes a new method query(queryStr), where queryStris a string to find within the table. By default, the search is case insensitive.

Custom search result class

By default searchPluginadds htSearchResultclass to every cell which isSearchResultproperty is true. You can change this class using searchResultClassoption. If you wish to change the result class globally (for all Handsontable instances on the page), you can use Handsontable.Search.global.setDefaultSearchResultClass(className)method.

Custom query method

The queryMethodis responsible for determining whether a queryStrmatches the value stored in a cell. It takes 2 arguments: queryStrand cellData. The first is a string passed to query()method. The second is a value returned by getDataAtCell(). The queryMethodfunction should return true if there is a match.

Custom callback

After calling queryMethod, searchPlugincalls callback(instance, rowIndex, colIndex, cellData, testResult)for every cell. The default callback is responsible for setting the isSearchResultproperty, so if you want to preserve this functionality, be sure to invoke Handsontable.Search.DEFAULT_CALLBACKinside your custom callback.

0results found