Validate input
In this example, by using the beforeendedit
event you can prevent digits from being entered.
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('beforeendedit', function (event) { if (/\d+/.test(event.newValue)) { alert('NO DIGITS!'); event.preventDefault(); } }); app.append(gridElement);