Skip to main content

search()

Description

searches for cells by the specified parameters

The method can also open a search box in the top right corner of the spreadsheet and highlight the matched results

Usage

search( 
text?: string,
openSearch?: boolean,
sheetId?: string | number
): string[];

Parameters

  • text - (optional) the value to search
  • openSearch - (optional) if true, opens a search box and highlights cells with the matched results; false by default
  • sheetId - (optional) the ID of the sheet. By default, the method searches for cells on the currently active sheet

Returns

The method returns an array with IDs of the found cells

Example

const spreadsheet = new dhx.Spreadsheet("spreadsheet", {});
spreadsheet.parse(data);

// returns IDs of cells with the matched result, opens a search bar and highlights the found cells
spreadsheet.search("feb", true, "Income"); // -> ['C1']

Change log: Added in v5.0

Related article: Work with Spreadsheet