I am using AW.Grid 2.5.1. I have a requirement, not allowing user to enter more than 2 digits after decimal point in a grid cell, for example -
If User types 100.00 in a AW.Grid cell, and if he tries to edit cell with new value, let say, 100.999, is not allowed (he can enter 100.99 but not 100.999), but he tries to enter 1002.75, he is allowed to do so.
I am using grid.onKeyPress function. Using event's keyCode, i am able to stop user from entering values other than numbers(0-9, . <decimal point> and - <negative sign>) but, not able to control user to from entering digits after dot. Any suggestions?
Monday, June 23, 2008
You can use onCellTextChanging event to restrict the user input. For example, here is the code which only allows to type digits in the cell -