简体   繁体   中英

Ext js 4.2 destroy component

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.

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, eg when it has never been rendered (for whatever reason).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM