Skip to main content

isLocked()

Description​

Checks whether a cell(s) is(are) locked

Usage​

isLocked(cell: string): boolean;

Parameters​

  • cell - (required) the id(s) of a cell(s) or a range of cells

Returns​

The method returns true if the cell is locked and false if it's unlocked

Example​

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

// checks whether a cell is locked
const cellLocked = spreadsheet.isLocked("A1");

// checks whether several cells are locked
const rangeLocked = spreadsheet.isLocked("A1:C1");

// checks whether scattered cells are locked
const cellsLocked = spreadsheet.isLocked("A1,B5,B7,D4:D6");
info

If several cells are checked at once, the method returns true if there is at least one locked cell among the specified cells.

info

Starting with v4.1, the reference to a cell or a range of cells can be specified in the following format:

const cellsLocked = spreadsheet.isLocked("sheet1!A2"); 

where sheet1 is the name of the tab.

If the name of the tab isn't specified, the method checks the cell(s) of the active tab.