There are a couple of syntaxs for extending a ‘class’ with the Ext library. I prefer the following syntax.
MyNewForm = Ext.extend(Ext.form.FormPanel,{
constructor:function(config){
…..
MyNewForm.superclass.constructor.call(this,config);
….
},
newMethod:function(){
}
})
I had a strange problem today. I had two almost identical classes. In one I could get a console log statement in the constructor to output. In the other I could not get it to work. The problem was I also didn’t get an error. The problem component would initialize and I could see it in the firebug dom tree.
Took me about 20 minutes to figure out the problem. Turns out I typed ‘construtor’ on the second class. Since Ext automatically calls the parent class constructor (if you do not override) I wasn’t getting an error.
Crazy how little typos can waste a lot of time…. so if you have this same problem, make sure you actually typed what you though you typed.
