user800014
user800014

Reputation:

Keyup event not fired with Sencha's Architect code

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/

UpperCaseTextField

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

Answers (1)

Ye Liu
Ye Liu

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

Related Questions