I dynamically create controllers in my application like this:
var loadedController = me.app.getController(controller_name);
loadedController.init();
How can I delete this controller after using?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ExtJs currently does not support removal of controllers out of the box. To cleanup a controller, do the following:
Ext.app.EventBuswith a methoduncontrolthat unregisters all event listeners that this controller registered on the EventBus. Check out the source ofExt.app.EventBus#controlto derive an implementation. Or use this one.Ext.app.Applicationwith a methodremoveControllerthat removes a given controller instance from thecontrollerscollection. It’s a Ext.util.MixedCollection, check out the source forExt.app.Application#getController. Then clean up all registered listeners for that controller usinguncontrol.destroymethod either on your specific controller and/or extendExt.app.Controller. You should at least callclearManagedListeners()and possibly destroy other objects created by this controller like views or stores, if that suits your application architecture and controller life-cycle.