PDA

View Full Version : [1.1beta1] Improvement for grid key handling



willydee
26 Jun 2007, 12:28 PM
Today I implemented a grid sorting scheme with keyboard navigation. I'm leaving the details out because this would be rather complex to describe -- feel free to ask for a code example if needed. The problem I discovered is that sometimes the keyboard events no longer reach my handler after a row is selected by program logic. After taking a deep look into GridView's code I was able to work around this by adding a subsequent focusRow() call:

grid.getSelectionModel().selectRow(index);
grid.getView().focusRow(index);
In my opinion this call should be directly included into the Ext.grid.GridView.selectRow() method.

tryanDLS
26 Jun 2007, 1:51 PM
My thought would be that the issue is that if focus is somewhere else, you're forcing it back to the grid on selection. If you're doing something external to the grid that causes a selection change, you may not want focus to automatically go to the grid (e.g. you might have to do a series of non-grid tasks). I'm not sure that selecting a row should be that closely tied to the grid display - what if you wanted to allow the user to select multiple rows from some external 'thing' - it would have to jump back and forth repeatedly.

willydee
28 Jun 2007, 1:04 AM
The builtin keyNav handler does exactly the same