isRanged()
pro version only
This functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) package.
checks whether a cell is within the current range
Usage
isRanged(cell: { x: string | number; y: string | number }): boolean;
Parameters:
cell | (object) - an object with the x and y coordinates of a cell, where:
|
note
You can specify just x
or y
to check a column or a row, correspondingly.
Returns:
true
, if the cell is within the current range, false
otherwise
Example
// this example shows checking whether an ID belongs to the selected range of cells
const grid = new dhx.Grid("grid_container", {
// other configuration
columns: [
{ id: "a", header: [{ text: "A" }] },
{ id: "b", header: [{ text: "B" }] },
],
data: [
{ id: "1", a: "A1", b: "B1" },
{ id: "2", a: "A2", b: "B2" },
],
rangeSelection: true
});
grid.range.setRange({ xStart: "a", yStart: "1", xEnd: "b", yEnd: "2" });
console.log(grid.range.isRanged({ x: "a", y: "1" })); // -> true
console.log(grid.range.isRanged({ x: "a" })); // -> true
console.log(grid.range.isRanged({ y: "3" })); // -> false
Related article: Work with Range Selection object
Related API: setRange()
Change log:
added in v9.2