PDA

View Full Version : Get keypress in Select even of BoundList of Combobox



ching29
20 Mar 2018, 3:23 AM
Hello,

I have a problem getting what key was pressed in my combobox's boundlist. The scenario is I have a combobox and conifgured the list using the listConfig. I want the select event fires ONLY after Enter key is pressed. Select event fires when Tab is also pressed and I want dont want it to happen. There is no specialkey event available for Boundlist. Please help. Thank you.

P.S. Adding specialkey event in combobox listener is not an option, since I want the event to happen in the Boundlist and not in the combobox.

Please see code below.



xtype: 'combobox',
store: comboAttendee,
queryMode: 'local',
displayField: 'FULLNAME',
valueField: 'IDNUMBER',
width: 190,
typeAhead: true,
hideTrigger: true,
forceSelection:true,
anyMatch: true,
enableKeyEvents: true,
emptyCellText: null,
listConfig: {
id: 'boundListAttendees',
maxHeight: '200',
shrinkWrap: 2,
listeners: {
'select' : function( combo, records, eOpts){
p1 = Ext.getCmp('boundListAttendees');
p1.getEl().setVisible(false);
gridAttendees.add({
IDNUMBER: records.get('IDNUMBER') ,
SCORE: Ext.getCmp('score').value,
STATUS: records.get('STATUS')
});
Ext.getCmp('attendeeCombo').clearValue();
}
}
},
listeners: {
'keypress' : function(){
p1 = Ext.getCmp('boundListAttendees');
p1.getEl().setVisible(true);
p1.getEl().setHeight(200);

},
'blur' : function(){
p1 = Ext.getCmp('boundListAttendees');
p1.getEl().setVisible(false);
}
}