Set filter function
By default, the filter is a RegExp string, you can alter this per data type by adding a function to the object grid.filters.<type>.
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, schema: [ { name: 'id', type: 'number' }, { name: 'offendit', type: 'string' }, ], }); app.append(gridElement); grid.filters.number = function (value, filterFor) { if (!filterFor) { return true; } return value === filterFor; }; grid.setFilter('id', 1);