Skip to main content

Set the width of a column

Set the width of a column

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.setColumnWidth(0, 60);
grid.setColumnWidth(1, 200);