Skip to main content

beforeRowAdd

caution

The beforeRowAdd event has been deprecated in v4.3. The event will continue work, but you'd better apply a new approach:

spreadsheet.events.on("beforeAction", (actionName, config) => {
if (actionName === "addRow") {
console.log(actionName, config);
return false;
}
});

For more details about the new concept, see Spreadsheet actions.

Description

Fires before a new row is added

Usage

beforeRowAdd: (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 add a row, false to prevent adding of a row

Example

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

// subscribe on the "beforeRowAdd" event
spreadsheet.events.on("beforeRowAdd", function(cell){
console.log("A new row will be added");
console.log(cell);
return true;
});

Related articles: Event handling