Reputation: 4021
How can I correctly destroy a component inside Ext js 4.2
According to the docs:
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.Component there is no destroy method. My components are children of a container so I have tried container.remove('componentReference')
but this is giving me unexpected behaviour, so is there any way to remove the component itself.
Upvotes: 1
Views: 4288
Reputation: 4047
A component usually is destroyed when it is removed from its owning container, unless you configure your container not to do so.
Refer to the autoDestroy config and the remove function of Ext.container.AbstractContainer
.
Furthermore, for Ext.panel.Panel
and classes extending it there is a close function, which will also result in destruction of the component, unless a different closeAction is specified.
That being said, there might be scenarios where it can actually be useful to directly invoke a component's destroy function although this is marked as private, e.g. when it has never been rendered (for whatever reason).
Upvotes: 3