Grid / when adding a cell / using regular expression question


#1

Grid = new dhx.Grid(null, {
columns: [
{id: “a”, header: [{ text: “a”, align: “center” }]},
{id: “b”, header: [{ text: “b”, align: “center” }]},
editable: true
});

When adding a cell to enter the a column
I want to use the following regular expression so that only numbers can be entered.

this.value = this.value.replace(/[^0-9]/g,’’);

How can I apply this?


#2

You may use the efterEditStart event for the input validation
https://docs.dhtmlx.com/suite/grid/api/grid_aftereditstart_event/
Like:
https://snippet.dhtmlx.com/bahns35l