Skip to main content

beforeClear

caution

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

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

Description

Fires before a spreadsheet is cleared

Usage

beforeClear: () => void | boolean;

Returns

Return false to prevent clearing a spreadsheet; otherwise, true.

Example

const spreadsheet = new dhx.Spreadsheet("spreadsheet", {
// config parameters
});
// subscribe on the "beforeClear" event
spreadsheet.events.on("beforeClear", function(){
console.log("A spreadsheet will be cleared");
return false;
});

Changelog: Added in v4.2

Related articles: Event handling