我希望我的领域在失焦时提交。(模糊事件)。触发提交的事件是一个 ENTER 键事件。所以我这样做了:
outOfFocus: function(field, event) {
console.log('Lost focus');
field.fireEvent('specialkey', field,
Ext.create('Ext.EventObject', {
key: Ext.EventObject.ENTER
})
);
},
但它不起作用。Firebug 说了一些关于: TypeError: c is not a constructor。
有什么想法吗?
评论中要求的更多周围代码:
表格:
var editPic = "<img src='https://s3.amazonaws.com/bzimages/pencil.png' alt='edit' height='24' width='24' style='margin-left: 10px;'/>";
var submitPic = "<img id='submitPic' src='https://s3.amazonaws.com/bzimages/submitPic.png' alt='edit' height='24' width='24'/>";
Ext.define('BM.view.test.Edit', {
extend: 'Ext.form.Panel',
alias: 'widget.test-edit',
layout: 'anchor',
title: 'Edit Test',
defaultType: 'displayfield',
items: [
{name: 'id', hidden: true},
{
name: 'name',
fieldLabel: 'Name',
afterSubTpl: editPic,
cls: 'editable'
},
{
name: 'nameEdit',
fieldLabel: 'Name',
xtype: 'textfield',
hidden: true,
cls: 'editMode',
allowBlank: false,
afterSubTpl: submitPic
}
]
});
控制器:
this.control({
'test-edit > displayfield': {
afterrender: this.showEditable
},
'test-edit': {
afterrender: this.formRendered
},
'test-edit > field[cls=editMode]': {
specialkey: this.editField,
blur: this.outOfFocus
}
});
这足以理解我在做什么吗?