开发者

Button click event Ext JS

开发者 https://www.devze.com 2023-01-04 23:02 出处:网络
I have the simple form: myForm = new Ext.form.FormPanel({ width:\'100%\', frame:false, items: [ new Ext.form.TextArea({

I have the simple form:

   myForm = new Ext.form.FormPanel({
      width:'100%',
      frame:false,
      items: [
         new Ext.form.TextArea({
            id:'notes',
  name: 'notes',
  hideLabel: true,
            width:350,
            height:200
         })
      ],
      buttons: [
         {
    text:"Save",
    click: function (b,e) {
     alert('x');
    }
  }
      ]
   });

However I am having trouble getting the click event of the button to work. Do buttons created the following w开发者_如何转开发ay have the same functionality of doing Ext.Button?


You either need

a) The handler option (a click shortcut)

new Ext.Button({
    handler: function(){ 
        // ....
    }
});

b) Event listeners need to be registered in in a listeners block, so

new Ext.Button({
    listeners: {
        click: function(){
            // ...
        }
    }
});

A) is preferred.

0

精彩评论

暂无评论...
验证码 换一张
取 消