Skip to main content

Select an area

Select an area of the grid using a rect object.

import canvasDatagrid from 'canvas-datagrid';
import data from '/data.json';

const app = document.getElementById('app');
const gridElement = document.createElement('div');
const grid = canvasDatagrid({
  parentNode: gridElement,
  data,
});

app.append(gridElement);

grid.selectArea({
  top: 2,
  bottom: 6,
  left: 1,
  right: 2,
});
grid.draw();