为什么我的关键事件在以下示例中不起作用?'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
我错过了一些明显的东西吗
| 归档时间: |
|
| 查看次数: |
1198 次 |
| 最近记录: |