PDA

View Full Version : Multiple controllers or one?



pinidbest
30 Apr 2012, 11:22 PM
I have a web application does besides the static declared views and controllers should also load widgets from a “bucket of widget” the user can add to the page.
So this means I am creating the views dynamically and want to load their controllers again (The controller have not been declared in the application controllers mixed collection)

If I am having many instances of the same view,
Should they use the same controller of have a controller instance for each of the views?
What is the best practice for this?


At the moment I am loading the views dynamically and I am loading only a single view using the getController function Ext API is offering (But this methods check to see if a controller with the same name already been loaded and this causes for a single controller to exists.

The problem with that is that the controller now control each event from the view many times (for each instance) .
Do I need to change the code for the controller so he will know to whom to listen or to load a controller for each view instance as well???

pinidbest
1 May 2012, 2:24 AM
Never mind, Found the answer here...
http://www.sencha.com/forum/showthread.php?140986-MVC-Multiple-instances-of-Controllers