Skip to main content

beforeFocusSet

Description

Fires before focus is set on a cell

Usage

beforeFocusSet: (cell: string) => void | boolean;

Parameters

The callback of the event takes the following parameters:

  • cell - (required) the id of a cell

Returns

Return true to set focus on a cell, false to prevent setting focus

Example

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

// subscribe on the "beforeFocusSet" event
spreadsheet.events.on("beforeFocusSet", function(cell){
console.log("Focus will be set on a cell "+spreadsheet.selection.getSelectedCell());
console.log(cell);
return true;
});

Related articles: Event handling