This is very od, ill explain it the best I can.
I'm watching for keypress events. See below of strange results.
1) if I press a key on the stage event Triggers
1) if I press a key on a grid event Triggers
1) if I'm in edit mode on a grid only the 5th key press ( letter or number ) fires the browser keypress event.
a) double click to edit a cell
b) press the letter a ( not event fires )
c) press the letter b ( not event fires )
d) press the letter c ( not event fires )
e) press the letter d ( not event fires )
f) press the letter e ( event fires )
Any ideas? I need my even to fire after any keypress.
"I mean not your product's code, but a simple html page" Oh I do understand what you mean but this is not just a simple page. The html is all dynamic so there is no way to show it in simple terms, that I know of. The code the generates the html is 1000 lines long.
Which events?
and
How do you handle this key press event?
like so.
//BROWSER CHECK if ( document.addEventListener ) { document.addEventListener( "keypress", keypress, false ); }//try to catch key presses from all browsers. else if ( document.attachEvent ) { document.attachEvent( "onkeypress", keypress ); } else { document.onkeypress = keypress } function keypress( e ) {alert( e.keyCode )<---- this="" alert="" would="" popup="" if="" any="" of="" these="" events="" were="" triggered="" so="" strong=""> if ( _currentWindowActive != null && (e.keyCode == 27 || e.keyCode == 13 || e.which == 27 || e.which == 13 || _currentWindowActive.isEditing() )) return true;//http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes _currentWindowActive.setEditMode( true, e.keyCode || e.which ); return false; }
if you want to handle the keypress while in edit mode the best way to do it is to hook to the igEditor.keypress event. While in edit mode the grid displays igEditors for each cell. Here is an example code on how to hook to the keypress event of igEditor for column "Name":
This does work in the sense that it fires an event for each key press but I'll never know what column I'm in and if the columnKey is a needed field I have no way to predict that.
My only guess is that something is blocking my browser keypress events when in a cell for editing. As far as I know there are no debugging tools to debug events.
If you have no further suggestions I thank you for your time.
--------------------------------------------------------------------------------------------
Oh BTW: In chrome and IE I never get browsers events. In FF its the 5th key press. I found a way to handle his and made it consistent fixing my issue. I would still be interested in hering any advice you may have but this fix I made for FF will do.
Hello Sean,
If you want to handle the keypress while in edit mode the best way to do it is to hook to the igEditor.keypress event. While in edit mode the grid displays igEditors for each cell. Here is an example code on how to hook to the keypress event of igEditor for column "Name":
Best regards,Martin PavlovInfragistics, Inc.
Unfortunately I don't understand your issue. That's why asked for a sample. And by sample I mean not your product's code, but a simple html page which has a grid on it with configuration which represents the problem.
seang said: I put alerts in both to see if they where firing and when I double click editCellStarting fires as it should but pressing letters does not fire these events.
seang said:re-cap: Once in edit mode my keep press event does not fire until I type the 5th character.
seang said:In your experience would you suggest any debug tools to catch the problem?
I use Chrome and its developer tools to do JavaScript development.
No I dont do any stops or return false's. The code is quite involved to the point I can not example it. It sounds to me like you understand my issue. The only two events in update I use are editCellStarting and editCellEnded. I put alerts in both to see if they where firing and when I double click editCellStarting fires as it should but pressing letters does not fire these events.
I have a few other elements on the page like a tree with a text box in it and it works as it should. So I know its the grid that has the problem. The only place the event has this problem is in a cell edit mode. Even pressing on a grid header works correctly, as if the edit mode may be to blame?
re-cap: Once in edit mode my keep press event does not fire until I type the 5th character.
In your experience would you suggest any debug tools to catch the problem?
You can explain it the best with a sample :)
On which element you're looking for the keypress? The behavior you're observing may be caused by the grid updating not bubbling the keypress event in some cases i.e. calling event.stopPropagation().
Again, a sample will explain it the best.
Thanks,Martin PavlovInfragistics, Inc.