attachEvent + keypress

I’m attempting to limit the input of a column to numeric only. I found this entry, dhtmlx.com/docs/products/kb/ … etColTypes numeric, but it didn’t work for me. It only activated when the user entered the column, not on the keypress.



I also checked some for of ColType, but didn’t find anything in the kb.



GRID SETUP.

grdNewOrderSelections = new dhtmlXGridObject(‘grdNewOrderSelections_Container’)

grdNewOrderSelections.setHeader(",");

grdNewOrderSelections.setNoHeader(true);

grdNewOrderSelections.setInitWidths(“20,135,45,20”);

grdNewOrderSelections.setColTypes(“txt,ro,ro,ro”);

grdNewOrderSelections.setColAlign(“right,left,right,right”);





Thanks,

James

You can use “onKeyPress” event. This event occurs after a key was pressed but before the default key processing starts. onKeyPress event passes the following parameters:
code - key code;
cFlag - control key flag;
sFlag - shift key flag.
grid.attachEvent(“onKeyPress”, function(code,cFlag,sFlag){});


Thanks, however it’s not returning anything



grdNewOrderSelections.attachEvent(“onKeyPress”, function(code,cFlag,sFlag){alert(‘keypress:’+code);});



When the user double-clicks and starts entering text into the field I do not get the alert.  Any ideas?



Thanks,
James



 

Please find example of implementing necessary behaviour here dhtmlx.com/docs/products/dhtmlxG … ength.html