Extension js

I have a 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 unable to get the button click event to work. Buttons created as follows have the same functionality as Ext.Button?

+3
source share
1 answer

You either need

a) Handler parameter (shortcut on click)

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

b) Event listeners must be registered in the listener block, therefore

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

A).

+7
source

Source: https://habr.com/ru/post/1751782/


All Articles