Skip to main content

beforeCopy

pro version only

This functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) package.

fires before copying or cutting data

Usage

beforeCopy: (isCut: boolean) => boolean | void;

Parameters:

The callback of the event is called with the following parameters:

  • isCut - indicates whether the operation is a cut (true) or a copy (false)

Returns:

Return false to cancel the operation; otherwise, true

Example

const grid = new dhx.Grid("grid_container", {
columns: [
{ id: "a", header: [{ text: "A" }] },
{ id: "b", header: [{ text: "B" }] },
],
data: [
{ id: "1", a: "A1", b: "B1" },
],
clipboard: true
});

grid.clipboard.events.on("beforeCopy", (isCut) => {
if (isCut) {
console.log("Cutting canceled");
return false;
}
});

Related API: afterCopy

Related article: Work with Clipboard module

Change log:

added in v9.2