<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ZingGrid: Docs Getting Started</title> <!--Script Reference[1]--> <script nonce="undefined" src="https://cdn.zinggrid.com/zinggrid.min.js"></script> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } zing-grid[loading] { height: 317px; } </style> </head> <body> <zing-grid caption="Register Custom Filterer" filter="inline"> <zg-colgroup> <zg-column index="first" filterer="number"></zg-column> <zg-column index="last" filterer="lettersOnly"></zg-column> <zg-column index="number"></zg-column> </zg-colgroup> <zg-data data='[ { "first": "Maria", "last": "John", "number": 123 }, { "first": "David", "last": "Smith", "number": 456 }, { "first": "Felicity", "last": "Snow", "number": 789 } ]'></zg-data> </zing-grid> <script> ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']); let customFilter = { afterInit(oDOMFilter) { let oDOMInput = oDOMFilter.querySelector('input'); oDOMInput.addEventListener('keypress', (e) => { if (!/^[a-z]$/i.test(e.key)) e.preventDefault(); }); }, }; ZingGrid.registerFilterer(customFilter, 'lettersOnly'); </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ZingGrid: Docs Getting Started</title> <!--Script Reference[1]--> <script src="https://cdn.zinggrid.com/zinggrid.min.js"></script> </head> <body> <zing-grid caption="Register Custom Filterer" filter="inline"> <zg-colgroup> <zg-column index="first" filterer="number"></zg-column> <zg-column index="last" filterer="lettersOnly"></zg-column> <zg-column index="number"></zg-column> </zg-colgroup> <zg-data data='[ { "first": "Maria", "last": "John", "number": 123 }, { "first": "David", "last": "Smith", "number": 456 }, { "first": "Felicity", "last": "Snow", "number": 789 } ]'></zg-data> </zing-grid> </body> </html>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
let customFilter = { afterInit(oDOMFilter) { let oDOMInput = oDOMFilter.querySelector('input'); oDOMInput.addEventListener('keypress', (e) => { if (!/^[a-z]$/i.test(e.key)) e.preventDefault(); }); }, }; ZingGrid.registerFilterer(customFilter, 'lettersOnly');