PDA

View Full Version : Disable spacebar toggle in Grid



JasonMO
11 Jun 2014, 6:13 PM
When you select a row and press spacebar it toggles the selection. Not sure why...

How can I go about disabling this functionality without turning off enableKeyNav.

I assume I need to override the onKeyPress event for Ext.selection.RowModel, but how do I do this? I've tried various ways and none seem to work.



//This didn't work....
Ext.override('Ext.selection.RowModel', {
onKeyPress: function(e, t) {
console.log(e);
}
});
//This also didn't work...
Ext.define('MyApp.selection.RowModel', {
override: 'Ext.selection.RowModel',
onKeyPress: function(e, t) {
console.log(e);
}
});

JasonMO
15 Jun 2014, 3:32 PM
Still looking for an answer to this one if anyone knows.

JasonMO
16 Jun 2014, 7:25 PM
So it seems onKeyPress doesn't exist in 4.2.2 which is what I was using.Ended up going with...


Ext.define('MyApp.selection.RowModel', {
override: 'Ext.selection.RowModel',
onKeySpace: function(e) {
console.log(e);
}
});


Source: http://docs.sencha.com/extjs/4.2.2/source/RowModel.html