PDA

View Full Version : Ext.container.Container and not destroyed Components



dominikgr
23 May 2016, 5:11 AM
Hi everyone,
Maybe that is design problem, but in my project I use Ext.container.Container to load sub pages for one html page. So one page consists of sub pages that are loaded with Ext.container.Container. That sub pages contains also ExtJs Components.
Problem is that if I reload Ext.container.Container on the page all ExtJs Components from subPages will be not destroyed. I thought that maybe I will destroy all Components with el.dom that did exist any more in document, something like:

Ext.ComponentManager.all.each(function(cmpId, cmp){
if(cmp && cmp.el && cmp.el.dom && !document.contains(cmp.el.dom)){
Ext.ComponentManager.unregister(cmp);
if(cmp.destroy){
cmp.destroy();
}
}
});

Is that good idea?