View Full Version : How to slideout and destroy?

12 Aug 2011, 4:22 PM

How to slide out a panel and then close?

i tried like this but it doesnt remove the panel, it just seems to be hiding

this.el.slideOut('b', {remove: true});

in the panel configuration i have this

closable: true,
closeAction: 'destroy',

what i want to do is slideout panel then close it. any idea how to do this?

12 Aug 2011, 5:49 PM
Hmm... good point. I thought it'd drop it from the DOM altogether. I just tried it with remove: true and remove: false both. I didn't see a difference.

13 Aug 2011, 12:07 AM
yeah. hope there is a way to achieve this

14 Aug 2011, 6:13 AM
I agree there's something slightly strange going on with the remove option. That said, I don't think it'd do quite what you're looking for anyway. Removing the component's el from the DOM wouldn't destroy the component, it would still exist and would still be taking up resources.

What about this?

this.getEl().slideOut('b', {
scope: this,
callback: function() {
// this.destroy();
Ext.defer(this.destroy, 1, this);

Theoretically it shouldn't need the defer, it should be possible just to call this.destroy(). In practice this gives an error. Having stepped through it in a debugger it seems that it tries to do the final component hiding after it calls the callback, which blows up if the component has been destroyed.

14 Aug 2011, 6:47 AM

http://www.sencha.com/forum/showthread.php?138692 - remove option not working.
http://www.sencha.com/forum/showthread.php?143786 - callback defer issue.