Skip to main content

beforeSetRange

pro version only

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

fires before setting a new range

Usage

beforeSetRange: (
range: {
xStart: string | number;
xEnd: string | number;
yStart: string | number;
yEnd: string | number;
}
) => boolean | void;

Parameters:

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

range(object) an object with the range coordinates that contains the following options:
  • xStart - (string | number) the starting column id
  • xEnd - (string | number) the ending column id
  • yStart - (string | number) the starting row id
  • yEnd - (string | number) the ending row id

Returns:

Return false to prevent setting a range; otherwise, true.

Example

const grid = new dhx.Grid("grid_container", {
// other configuration
rangeSelection: true
});

grid.range.events.on("beforeSetRange", (range) => {
if (range.xStart === "b") {
console.log("Range can't start with the column B");
return false; // cancels setting a range
}
});

grid.range.setRange({ xStart: "b", yStart: "1" }); // setting a new range is canceled

Change log:

added in v9.2