PDA

View Full Version : What is the best way to destroy a control



webfriend13
1 Apr 2012, 10:24 PM
Hi all,

I want to know what is the best way to destroy a control in ExtJs 4.07. The idea is to remove the control from the page to ensure it is garbage collected to prevent memory leakage.

I am specifically looking to destroy a EXTJS grid. I am aware of destroy method, but I think in my case even after calling destory the elemets within the grid is not been garbage collected. Do i need to perform some more steps.

Please provide your suggestions.

Thanks in advance

ddsbn
1 Apr 2012, 10:30 PM
var me = this;
me.controllers.remove(controller);
for(var i=0,len=controller.selectors.length;i<len;i++){
var obj = controller.selectors[i];
for(var s in obj){
for(var ev in obj[s]){
//remove selectors from event bus
delete me.eventbus.bus[ev][s];
}

}
}
delete controller;