View Full Version : Destroy a form in ext 1.1 / Inheritance problem

13 Aug 2007, 3:18 AM
Hi all,

As I load every page using ajax in a div, I'd like to remove everything just created before loading another page.
Therefore, I register all my components, and call the destroy() method of each component when needed. Now I'm creating a form and I do not see a destroy() method for the Ext.form.Form... Is that because there's nothing to destroy()...?

Anyway, I'd expect to have one, to remove/detach all fields in that form, and to remove all html elements again.

So I set out to inherit the form and create a destroy method:

Ext.ux.Form = function(config){

Ext.extend(Ext.ux.Form, Ext.form.Form, {
destroy : function() {
alert('destroy form');

But this code fails on the superclass construtctor call, as here the config is ok, but I stepped into toe superclass constructor (Ext.form.Form) and there the config is empty (undefined). Am I doing something wrong here? Am I missing something?

The call to create the form is:

this.form = new Ext.ux.Form({
labelAlign: 'right',
labelWidth: 175,
buttonAlign: 'right'


15 Aug 2007, 9:42 AM
Your call to the superclass constructor should be:

Ext.ux.Form.superclass.constructor.call(this, config);

I had this exact same problem with undefined config. Turns out I needed to qualify scope as the first parameter. (even though it didn't appear in the signature of the method)