私は、OnClick()メソッドをExt.form.Textコンポーネントに追加する方法を知りたいと思います。コンポーネントがテキストフィールドである場合OnClickメソッドをTextField(ExtJS Framework)に追加する方法はありますか?
handler: function() {alert("Hello!");}
しかし、その行doesn't作品:コンポーネントがボタンの場合
は、その後、私がしなければならないすべては、この行を追加することです。以下の例を見てください:
Ext.create('Ext.form.Panel', {
title: 'Contact Info',
width: 300,
bodyPadding: 10,
renderTo: Ext.getBody(),
items: [{
id: 'myButton',
xtype: 'textfield',
name: 'name',
fieldLabel: 'Name',
style: 'background-color: #ddd;',
allowBlank: false,
handler: function() {Ext.getCmp('myButton').setValue("TEXT")} // Does not work!
}, {
xtype: 'button',
name: 'email',
fieldLabel: 'Email Address',
style: 'background-color: green',
textfieldStyle: 'background-color: green',
handler: function() {Ext.getCmp('myButton').setValue("TEXT")} // Works!
}]
});
これは役立つかもしれない[http://stackoverflow.com/questions/ 7260134/extjs-4-event-handling-tutorial/7261836#7261836](http://stackoverflow.com/questions/7260134/extjs-4-event-handling-tutorial/7261836#7261836) –