4

I try to extend Button like in sencha example.
I do fiddle
And get error: TypeError: this.addEvents is not a function : 'statesave'.
Whats wrong?

sra
  • 23,820
  • 7
  • 55
  • 89
Kliver Max
  • 5,107
  • 22
  • 95
  • 148

2 Answers2

4

You just forgot to call new and you had a typo see JSFiddle

PuffButton = Ext.extend(Ext.Button,{
    constructor: function(config){
        PuffButton.superclass.constructor.apply(this,arguments);
        console.log("111111");
        this.on('click',function(){this.el.puff();},this);
    }
});
var puff = new PuffButton({text: 'Puff', renderTo:Ext.getBody()});
sra
  • 23,820
  • 7
  • 55
  • 89
2

Use define instead. Extend method is deprecated.

  Ext.define('Grid', {
    extend: 'Ext.grid.Panel',
    constructor: function (config) {
        this.callParent(arguments);
    }
});
Kremena Lalova
  • 531
  • 1
  • 4
  • 17