Categories | Question details Back To List | ||
attachEvent + keypress I'm attempting to limit the input of a column to numeric only. I found this entry, http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=6285&ssr=yes&s=setColTypes 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 Answer posted by dhxSupport on Sep 01, 2009 01:50 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){}); Answer posted by James Snyder on Sep 01, 2009 07:45 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,
Answer posted by dhxSupport on Sep 02, 2009 03:38 Please find example of implementing necessary behaviour here http://dhtmlx.com/docs/products/dhtmlxGrid/samples/cell_types/pro_maxlength.html |