Detect clicks
Detect which cell was clicked using the click
event.
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, }); grid.addEventListener('click', function (e) { if (!e.cell) return; grid.data[0][grid.schema[0].name] = 'Clicked on ' + e.cell.value; }; app.append(gridElement);