What's the relationship between Controllers and views ? How to organize them properly ?
How dose the Controller work ? Dose every view check if there is a Controller listens to its events when activating ?
For example,there are many views,should i put all the event handlers in one Controller or just create a Controller for each view ?
In my current project,we do not use Controller while just add the needed event handlers in the listeners config of the component.It seems everything gose well.So,is there a need to use Controller?
Can someone give me some usefull MCV examples ? I just wander how the Controller works in the MVC pattern.
Is there a need to use Controller in sencha touch?
749 Views Asked by gabriel aflext At
2
1) For the MVC implementation take a look at:
2) Not necessary, when you set a listener from any controller it attachs the handler to the web page. Same if you set the controller from the view config. Consider reading: http://docs.sencha.com/touch/2.2.1/#!/guide/events
3) That would depend on how you have organized your application, for example you could create a controller for each 'module', lets say clients and products. So all events listeners of the clients module's views could be in the clients controller and so. Or you could separate it depending on the models or maybe depending on the tabs if your app has them ¿?
4) Not really a need. But you are probably missing some interesting things, for example what if some listeners share part of their handlers? You have to write it on every view/component with all the re-work and maintenance issue it could take. And one great feature of using controllers is the getter/setter it auto creates for your refs.
5) Take a look at:
Also, the best would to review the examples that st provides in the package, for example geocongress, oreilly or kitchensink
As you can see there is a lot of info at the official site :)
Hope it helps