Skip to main content

beforePaste

pro version only

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

fires before pasting data from the clipboard

Usage

beforePaste: () => boolean | void;

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("beforePaste", () => {
if (!grid.range.getRange()) {
console.log("Paste canceled: no range specified");
return false;
}
});

Related API: afterPaste

Related article: Work with Clipboard module

Change log:

added in v9.2