Skip to main content

Add a row

There is also an insert version of this function.

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.addRow({
  col1: 'a ' + new Date().toString(),
  col2: 'b ' + new Date().toString(),
  col3: 'c ' + new Date().toString(),
});