beforeColumnDelete
caution
The beforeColumnDelete 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 === "deleteColumn") {
console.log(actionName, config);
return false;
}
});
For more details about the new concept, see Spreadsheet actions.
Description
Fires before a column is deleted
Usage
beforeColumnDelete: (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 delete a column, false
to prevent deleting of a column
Example
const spreadsheet = new dhx.Spreadsheet("spreadsheet", {});
spreadsheet.parse(data);
// subscribe on the "beforeColumnDelete" event
spreadsheet.events.on("beforeColumnDelete", function(cell){
console.log("A column will be deleted");
console.log(cell);
return true;
});
Related articles: Event handling