Skip to main content

beforeColumnAdd

caution

The beforeColumnAdd 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 === "addColumn") {
console.log(actionName, config);
return false;
}
});

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

Description

Fires before a new column is added

Usage

beforeColumnAdd: (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 column, false to prevent adding of a column

Example

const spreadsheet = new dhx.Spreadsheet("spreadsheet", {
// config parameters
});
// subscribe on the "beforeColumnAdd" event
spreadsheet.events.on("beforeColumnAdd", function(cell){
console.log("A new column will be added");
console.log(cell);
return true;
});

Related articles: Event handling