焦点が合っていないときに自分のフィールドを送信してほしい。(ぼかしイベント)。送信をトリガーするイベントは、ENTERキーイベントです。だから私はこれをしました:
outOfFocus: function(field, event) {
console.log('Lost focus');
field.fireEvent('specialkey', field,
Ext.create('Ext.EventObject', {
key: Ext.EventObject.ENTER
})
);
},
しかし、それは機能しません。Firebugは次のことについて何かを言います:TypeError:cはコンストラクターではありません。
何かご意見は?
コメントで要求された周囲のコードのもう少し:
フォーム:
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
}
});
これは私がしていることを理解するのに十分ですか?