Reputation:
I'm trying to figure out why my keyup event isn't fired. I created a UpperCaseTextField (inside Sencha Architect) and used that in a form (linked).
Live example: http://jsfiddle.net/wyQUb/
Ext.define('MyApp.view.UpperCaseTextField', {
extend: 'Ext.form.field.Text',
alias: 'widget.uppercasetextfield',
initComponent: function () {
var me = this;
Ext.applyIf(me, {
listeners: {
keyup: {
fn: me.onTextfieldKeyup,
scope: me
}
}
});
me.callParent(arguments);
},
onTextfieldKeyup: function (textfield, e, eOpts) {
var me = this;
alert('keyup');
var upper = me.getValue().toUpperCase();
me.setValue(upper);
}
});
Am I'm missing something or listeners
config should work?
Upvotes: 1
Views: 3003
Reputation: 8986
You need to enable key events for text field:
enableKeyEvents: true
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Text-cfg-enableKeyEvents
Upvotes: 6