1. #1
    Ext JS Premium Member Steffen Hiller's Avatar
    Join Date
    Mar 2008
    Posts
    770
    Vote Rating
    27
    Steffen Hiller will become famous soon enough Steffen Hiller will become famous soon enough

      0  

    Default Sencha Touch's MVC

    Sencha Touch's MVC


    I'm trying to wrap my head around the new MVC functionality of Sencha Touch these days.

    I'm comparing it a bit with server-side MVCing. So far my oberservation is that it doesn't seem as easy and clear as on the server-side, where basically one controller action responds to on client/user request.

    When looking at the Twitter example, I see "actions" in the controller as well as in the views, which confuses me.

    For example the following methods:
    Code:
    twitter.views.SearchBar: onSubmit()
    twitter.views.Searches: onItemTap(), onItemSwipe()
    twitter.views.TimeLine: onContainerTap()
    All those methods have quite some lines of logic and respond to user actions.

    Shouldn't that stuff go into controllers? If yes, how? If no, why? How do you difference those actions with the actions managed by the controllers?

    Thanks for any help for finding me the missing piece.

    P.S. @Sencha, with ST 1.0 out the door, any info on when we can expect more info/documentation on the MVC stuff?

  2. #2
    Sencha User
    Join Date
    Nov 2010
    Posts
    44
    Vote Rating
    0
    senchauser2010 is on a distinguished road

      0  

    Default


    I have similar questions. Hope someone from Sencha is going to do a post on MVC this week as mentioned in other posts.

    The code in routes.js seems clean, i.e. one that maps urls to controller/actions. But other events don't quite follow similar pattern; sometimes they are delegated to controller while sometimes they are handled the traditional way. Will be good to know the recommended best practices, especially for a relatively complex app with many views and events.

  3. #3
    Sencha User jamesgpearce's Avatar
    Join Date
    Jun 2010
    Location
    Palo Alto
    Posts
    61
    Vote Rating
    0
    jamesgpearce is on a distinguished road

      0  

    Default


    Quote Originally Posted by senchauser2010 View Post
    sometimes they are delegated to controller
    I personally use the dispatch approach because it means the 'internal' history stack is being buit up properly.

    I think it's worth remembering that the MVC architecture is quite new, and not all the demos are making full use of it yet.

    I have a personal goal to write plenty of tutorials and best practice docs for this, but please bear with us. We know there is lots more to do for documentation in general!

  4. #4
    Ext JS Premium Member Steffen Hiller's Avatar
    Join Date
    Mar 2008
    Posts
    770
    Vote Rating
    27
    Steffen Hiller will become famous soon enough Steffen Hiller will become famous soon enough

      0  

    Default


    Thanks for your response, James!

    I basically just needed a confirmation from Sencha's side that the examples are still incompletish and that I'm not overseeing something, especially since they always point people to those two examples (kiva & twitter).

    I know that documentation is always work in progress, I'm cool with that.
    Meanwhile, questions have to do it and actually should help with creating a documentation.

    Saludos

  5. #5
    Ext User
    Join Date
    Nov 2010
    Posts
    17
    Vote Rating
    0
    RobinQu is on a distinguished road

      0  

    Default


    Ext.dispatch() and Ext.ControllerManager.get() sometimes helps~

    and some views have "scope" and "handler" property can help you to hook up with a controller

    but it's a truth that MVC in Sencha is hard to use, you need too many glue code to follow this pattern.

Similar Threads

  1. Replies: 10
    Last Post: 20 Jan 2012, 10:10 AM
  2. Sencha Touch + MVC?
    By Bucs in forum Sencha Touch 1.x: Discussion
    Replies: 16
    Last Post: 2 Jul 2011, 12:19 PM
  3. Sencha Touch MVC framework and SCSS integration guides
    By lexer in forum Sencha Touch 1.x: Discussion
    Replies: 10
    Last Post: 5 Apr 2011, 10:53 PM
  4. Using Sencha Touch with ASP .Net MVC
    By atulbahl in forum Sencha Touch 1.x: Discussion
    Replies: 8
    Last Post: 24 Mar 2011, 12:33 PM

Thread Participants: 3