-
8 May 2009 7:35 AM #1
how to properly remove a panel
how to properly remove a panel
Hello,
I am dynamically creating and removing panels. Is there anything that I need to do (from a memory-release perspective) aside from just removing a panel from the parent container?
I have created some re-usable content panels and am trying to determine what method to override to null out class variables... I have tried
- onRemove
- onUnload
neither of these methods are executed when I remove the panel from it's container. Thank you very much for the help.
Joe Hudson
-
8 May 2009 7:44 AM #2
If you are not creating custom classes (extending), you'll may want to use the simple 'beforedestroy' listeners to handle specific cleanup tasks.
Then later:Code:somePanel.add({ id : 'test', title: 'Test', setSomeRefs : function(){ this.canvasEl = this.body.dom; //important to cleanup these DOM references up }, listeners:{ render : function(){ this.setSomeRefs() }, beforedestroy : function(){ this.canvasEl = null; } } }); somePanel.rendered && somePanel.doLayout(); //always call if the Container is already rendered.
Code:somePanel.remove('test',true); //forceful destruction somePanel.doLayout();"be dom-ready..."
Doug Hendricks
Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.
Got Sencha licensing questions? Find out more here.
-
8 May 2009 8:59 AM #3
Thank you for the reply.
What would be the appropriate GXT way of doing this? I see a remove method on LayoutContainer but it doesn't take an additional boolean parameter to optionally destroy the panel. And, I don't see a destroy method on LayoutContainer... Thanks.
Joe Hudson
-
8 May 2009 9:03 AM #4
Ah, GXT User ? Should have posted this in that forum. Would you like me to move this thread over there ?
"be dom-ready..."
Doug Hendricks
Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.
Got Sencha licensing questions? Find out more here.
-
8 May 2009 9:04 AM #5
Yes, that would be great. I'm sorry - I mean to post in that forum originally but I guess I got mixed up. Thank you very much.
Joe
-
10 May 2009 6:37 AM #6
No, there is nothing you have to do. GXT handles everything for you.


Reply With Quote

