Skip to main content

isSelectedCell()

checks whether the cell with the specified row and column parameters is selected

isSelectedCell(row: IRow | Id, column?: ICol | Id): boolean;

Parameters:

  • row: IRow | Id - an object with a cell to be checked or the id of a row
  • column: ICol | Id - the config of a column or its id

Returns:

Returns true if the cell is selected, otherwise false

Example

const grid = new dhx.Grid("grid_container", {
columns: [
// columns config
],
selection:"cell",
multiselection: false,
data: dataset
});

const row = grid.data.getItem(grid.data.getId(0));
const column = grid.getColumn("project");
grid.selection.setCell(row,column);

const selectedCell = grid.selection.isSelectedCell(row,column);
console.log(selectedCell); // -> true

Related article: Selection

Related API: setCell()

Change log:

added in v9.2