Skip to main content

Alter runtime style

Change styles after the grid has been instantiated. All styles can be changed at any time.

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.style.columnHeaderCellBackgroundColor = 'dodgerblue';
grid.style.columnHeaderCellColor = 'white';