View Full Version : Grid KeyPress
bobbasic2002
20 Jul 2007, 1:08 PM
How can I get the selection index of a grid during the KeyPress event, since the EventObject is the only thing being passed to that event?
thanks,
Bob
mystix
20 Jul 2007, 8:09 PM
in Ext 1.1 RC1, add a keypress listener on the grid, then call the GridView's (currently undocumented) findRowIndex() method like so:
grid.on('keypress', function(e) {
console.log('you just pressed a key in row ', grid.getView().findRowIndex(e.getTarget()));
});
sjivan
20 Jul 2007, 11:13 PM
in Ext 1.1 RC1, add a keypress listener on the grid, then call the GridView's (currently undocumented) findRowIndex() method like so:
grid.on('keypress', function(e) {
console.log('you just pressed a key in row ', grid.getView().findRowIndex(e.getTarget()));
});
Do you know why most listeners have the params (grid, rowIndex, colIndex, e) while a few like
click, contextMenu, dblClick, keyDown, keyPress
only have the EventObject passed in the callback?
Is this just an inconsistency that hasnt been changed due to backward compatibility reasons?
Sanjiv
mystix
21 Jul 2007, 10:08 PM
i have no idea why. :">
but it'll be a good idea to bring this up in the prerelease builds forum. :)
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.