DHTMLX Docs & Samples Explorer

Index
dhtmlxgrid

## Searching

The user should not forget to include dhtmlxgrid_filter.js file into the page.

### Attaching Functionality to Existing Input

The following method should be used to create a search box (set selection to the row with the value found) from any input:

            grid.makeSearch(id,column);

The parameters here are:

- id - {string|object} id of the input or input html object;
- column - {number} index of the column.

### Using Search API

Search API represented by single command

           grid.findCell(value, index , first )

Where parameters are:

- value - search mask, grid will search for any occurrence of the mask in the row's data;
- index - index against which search will be run, optional, if not defined - search will run against all columns of grid ( search with index defined will run a lot faster );
- first - flag which shows is only first occurrence need to be found, or all of them.

Method returns an array of data , for example

            [
                ["row_1","2"] //first result
                ["row_4","3"] //second result
            ]

Each sub-array contains a row ID and cell index for the cell where value in question was located.