X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/2e847cf21b8ab9d15fa167b315ca5b2fa92638fc..0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6:/src/widgets/form/Form.js diff --git a/src/widgets/form/Form.js b/src/widgets/form/Form.js index 0cf994f1..53022e06 100644 --- a/src/widgets/form/Form.js +++ b/src/widgets/form/Form.js @@ -1,8 +1,8 @@ /*! - * Ext JS Library 3.1.1 - * Copyright(c) 2006-2010 Ext JS, LLC - * licensing@extjs.com - * http://www.extjs.com/license + * Ext JS Library 3.3.1 + * Copyright(c) 2006-2010 Sencha Inc. + * licensing@sencha.com + * http://www.sencha.com/license */ /** * @class Ext.form.FormPanel @@ -201,12 +201,7 @@ Ext.FormPanel = Ext.extend(Ext.Panel, { // private beforeDestroy : function(){ this.stopMonitoring(); - /* - * Don't move this behaviour to BasicForm because it can be used - * on it's own. - */ - Ext.destroy(this.form); - this.form.items.clear(); + this.form.destroy(true); Ext.FormPanel.superclass.beforeDestroy.call(this); }, @@ -267,16 +262,20 @@ Ext.FormPanel = Ext.extend(Ext.Panel, { }, // private - processRemove : function(c){ - // If a single form Field, remove it - if(this.isField(c)){ - this.form.remove(c); - // If a Container, its already destroyed by the time it gets here. Remove any references to destroyed fields. - }else if(c.findBy){ - var isDestroyed = function(o) { - return !!o.isDestroyed; + processRemove: function(c){ + if(!this.destroying){ + // If a single form Field, remove it + if(this.isField(c)){ + this.form.remove(c); + // If a Container, its already destroyed by the time it gets here. Remove any references to destroyed fields. + }else if (c.findBy){ + Ext.each(c.findBy(this.isField), this.form.remove, this.form); + /* + * This isn't the most efficient way of getting rid of the items, however it's the most + * correct, which in this case is most important. + */ + this.form.cleanDestroyed(); } - this.form.items.filterBy(isDestroyed, this.form).each(this.form.remove, this.form); } },