PDA

View Full Version : [2.0] Proposal for Panel



hendricd
19 Oct 2007, 4:11 PM
When a contentEl is specified in the panel's constructor, it's left out in the cold come destruction time. Please add:



// private
onDestroy : function(){
if(this.tools){
for(var k in this.tools){
Ext.destroy(this.tools[k]);
}
}
Ext.destroy(
this.topToolbar,
this.bottomToolbar,
this.contentEl
);
Ext.Panel.superclass.onDestroy.call(this);
}

Without it, the contentEl gets abandoned in the destroy chain. :-?

Animal
19 Oct 2007, 11:51 PM
I don't know if that was by design, or if it's a bug. The contentEl config uses an existing element as the contents of the body of the newly created Panel.

I'm not sure that implies that that element should be destroyed when the Panel is destroyed.

In most uses, I think it should, since I can't really see much use for a content Element without it's panel - it wouldn't look good. But I can see perhaps, some content element being "abandoned" and then re-used as content by another Panel.

Perhaps it could be an option.

hendricd
20 Oct 2007, 5:49 AM
contentEl could really be anything, even another layout, or in my case, a managed IFrame in which the destroy method is implemented in it's interface.

I think there is likely minimal risk since BoxComponent:destroy checks to see of each member of the destruction chain:

a) exists
b) has a destroy method.

If a and b are true, it calls it's destroy method.