extjs remove fieldset on a form problem in firefox
I'm had a problem removing a fieldset in a form and replaced by another fieldset in one of my ExtJS scripts. The problem however, only appear in firefox and in only when the form is displayed on Ext.Window.
the original code i have:
/*other code definitions */ .... //check if this fieldset has already appended to form, destroy when already appended if(form.findById('fieldsetid')) { form.findById('fieldsetid').destroy(); } /*other code definitions */ .... //set fieldset var fieldset_fieldsetid = new Ext.form.FieldSet({xtype:'fieldset',id:'fieldsetid',title:'new fieldset',autoHeight:true, collapsible: true, items:[...]}); /*add the fieldset to form */ form.add(fieldset_fieldsetid); /* render the form */ form.doLayout();
The above codes will add new fieldset at the end of the form, but the fieldset I wanted to remove it's still there.. the labels are still on the form, only the inputs are gone. In IE, this does not occur...
After trial and errors, I got a dirty workaround, well at least this works for me.
Here's what I have changed to:
/*other code definitions */ .... //check if this fieldset has already appended to form, destroy when already appended if(form.findById('fieldsetid')) { var oldfieldset = form.findById('fieldsetid'); form.findById('fieldsetid').destroy(); } /*other code definitions */ .... //set fieldset var fieldset_fieldsetid = new Ext.form.FieldSet({xtype:'fieldset',id:'fieldsetid',title:'new fieldset',autoHeight:true, collapsible: true, items:[...]}); /*add the fieldset to form */ form.add(fieldset_fieldsetid); /* render the form */ form.doLayout(); /* ensure its deleted */ oldfieldset.destroy();
As you see, I added checks to ensure the old fieldset is destroyed after the form has been re-layout. So keep it this way first till I get cleaner solutions...
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

[...] having some problems with the removing fieldset on a form yesterday, I got some pointers from the ExtJS forum. This is known issue in ExtJS caused by some [...]