PDA

View Full Version : extend FormPanel and constructor



miha-ha
10 Sep 2010, 4:30 AM
Hi!
This code does not work

AbstractForm = Ext.extend(Ext.form.FormPanel, {

constructor: function( config){
AbstractForm.constructor.call(this, config);
}
});
var f = new AbstractForm();
//error: ext-all-debug.js:1459 Uncaught TypeError: Cannot read property 'added' of undefined

but this code works

AbstractForm = Ext.extend(Ext.form.FormPanel, {

});
var f = new AbstractForm();

how to use the constructor in a derived class???

Condor
10 Sep 2010, 4:32 AM
You are creating an infinite loop! You want:

AbstractForm = Ext.extend(Ext.Panel, {
constructor: function(config){
AbstractForm.superclass.constructor.call(this, config);
}
});

miha-ha
10 Sep 2010, 4:39 AM
Ops :) Yes!!! Thanks!