PDA

View Full Version : Combo keyNav vs specialkey



zachext
12 Aug 2010, 8:33 AM
In the following code, the keyNav only fires when when the combo list is expanded and the specialkey event only fires when the list is collapsed.

-Is this the expected behavior?
-Shouldn't both the keyNav and specialkey fire in both collapsed or expanded states?
-When would it be appropriate to use a keyNav instead of a specialkey event for handling say an enter key press?

Thanks for any info.



Ext.onReady(function () {

var cb = new Ext.form.ComboBox({
xtype: 'combo',
renderTo: Ext.getBody(),
mode: 'local',
store: ['one', 'two'],
listeners: {
afterrender: function () {
this.keyNav.enter = function () {
console.log('keyNav-Enter', arguments, this)
}
},
specialkey: function (f, e) {
if (e.getKey() == e.ENTER) { console.log('specialkey-Enter', arguments) }
}
}
})

})

coastal
20 Apr 2012, 3:47 AM
Thanks so much for pointing this out. I was trying to trap cursor keys in the combobox and couldn't work out why it would work fine for a closed combobox and not when its open.