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?
Asked
Active
Viewed 6,547 times
4

sra
- 23,820
- 7
- 55
- 89

Kliver Max
- 5,107
- 22
- 95
- 148
-
The link to the fiddle is not working – Amit Aviv Jun 20 '13 at 06:51
-
Remember to call the overwritten methods... `this.callParent(arguments)` – Andreas Louv Jun 20 '13 at 06:56
-
@NULL: Not sure that understand you. Can you give a example? – Kliver Max Jun 20 '13 at 06:58
-
1@NULL This is about ExtJS 3 so there is no `callParent` – sra Jun 20 '13 at 07:08
2 Answers
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