vendredi 3 octobre 2014

grid cell "key" events *after* selection change ?!?!

Picture a grid wherein cell (row=3, column=12) is active and has the focus.

When one presses an arrow key (let's say the right-arrow key) the cellkeydown event --- and better than that, even the before cellkeydown event --- both fire after the selected cell has changed to cell (3, 13). The cellIndex parameter passed to your beforecellkeydown handler has value 13.


But if you had pressed a more "normal" key (say the 'g' key), there would be --- I'm sorry, there would have been --- no selection change. And your handler would have been passed the value 12 for cellIndex.


So you cannot achieve the handling of motion keys prior to their effect upon selection. If there are any selection-change handlers, they already ran by the time the key events happen; too late to prevent them.


But even if you aren't wanting to cancel the key event, you're still gonna have fun handling it. Cuz the value of cellIndex passed to your handler differs according to which key was pressed.


Oh, and the cellfocus event? Occurs after the key-related events. So at the time of your key-event handler, cell selection and cell focus do not agree with each other.


Sencha's event logger for Chrome shows this all as:


Capture.JPG


Beautiful. How'd you Sencha guys think of that? It never would have occurred to me to go ahead and change the selection (due to a keyboard action) prior to the key event, so the key event looks like it's happening on another cell. But only for selection, not for focus.


I'm betting you won't admit it's a bug. Actually, you won't admit it's anything at all, since there's no fiddle.






grid cell "key" events *after* selection change ?!?!

Aucun commentaire:

Enregistrer un commentaire