为什么我的关键事件不起作用

Oli*_*ins 4 extjs extjs6

为什么我的关键事件在以下示例中不起作用?'blur'事件有效,但没有任何关键事件在我的文本字段上工作(我也试过'keydown').

我也尝试在控制器上使用'control'结构,但这也不起作用.

Ext.define('Plus.view.MyController', {
    extend: 'Ext.app.ViewController',

    alias: 'controller.mycontroller',
    control: {
        '#mytextfield': {
            blur: function() {
                alert("oink")
            },
            keypress: function() {
                alert("moo")
            },
            keyup: function() {
                alert("quack")
            }
        }
    }
});

Ext.define('Plus.view.MainView', {
    extend: 'Ext.container.Container',

    items: [{
        xtype: 'textfield',
        id: 'mytextfield',
        controller: 'mycontroller',
        listeners: {
            blur: function() {
                alert("oink 2")
            },
            keypress : function() {
                alert("moo 2")
            },
            keyup : function() {
                alert("quack 2")
            }
        }
    }]
});

Ext.application({
    name: 'Plus',
    autoCreateViewport: 'MainView',
    launch: function() {

    }
});
Run Code Online (Sandbox Code Playgroud)

我的小提琴在这里:

https://fiddle.sencha.com/#fiddle/1d5d

我错过了一些明显的东西吗

UDI*_*DID 7

keypresskeyup如果这些事件仅触发enableKeyEvents设置为true.设置此项,您的代码将起作用.我为你创建了一个代码工作的fidller.小提琴