Skip to main content

getRangedCells()

pro version only

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

returns an array of cells within the current range

Usage

getRangedCells(): { row: object; column: object; }[];

Returns:

  • an array of objects where:
row(object) the row object
column(object) the column object

Example

// this example shows retrieving of the range of selected 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: "1" });
console.log(grid.range.getRangedCells()); // -> [{ row: { id: "1", ... }, column: { id: "a", ... }}, ...]

Related article: Work with Range Selection object

Related API: setRange()

Change log:

added in v9.2