PDA

View Full Version : [FIXED][3.0 SVN 4972] Container remove



hendricd
5 Aug 2009, 12:52 PM
The very recent onRemove additions do not yet take into account the potential to remove items from a Container before either it or its layout are rendered yet (layout is still a string). Example of this occurs with the ProgressBarPager ux.plugin. It tries to remove an item from the Toolbar Container before it's rendered.

This is a temporary patch at best, but solves the problem short-term. :-?



/**
* Removes a component from this container. Fires the {@link #beforeremove} event before removing, then fires
* the {@link #remove} event after the component has been removed.
* @param {Component/String} component The component reference or id to remove.
* @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
* Defaults to the value of this Container's {@link #autoDestroy} config.
* @return {Ext.Component} component The Component that was removed.
*/
remove : function(comp, autoDestroy){
this.initItems();
var c = this.getComponent(comp);
if(c && this.fireEvent('beforeremove', this, c) !== false){
this.items.remove(c);
delete c.ownerCt;
if(this.layout && this.layout.onRemove){
this.layout.onRemove(c);
}
this.onRemove(c);
if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){
c.destroy();
}
this.fireEvent('remove', this, c);
}
return c;
},

evant
5 Aug 2009, 4:39 PM
Fixed in SVN.