Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: MVC structure migration

  1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    21
    Vote Rating
    0
      0  

    Default MVC structure migration

    Hy,

    so curious by that new release, I try this morning migration from 1.1 to 2
    Therefore... new errors, due to, I suspect, my Sencha architecture. I try to follow MVC requierement as presented during SenchaCon (cf video on document)

    But ... regApplication seems not to be accepted already
    (Uncaught TypeError: Object #<Object> has no method 'regApplication')

    So, did you plan a new tutorial about MVC structure developpement using sencha 2 ?
    Did I miss something ?

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Location
    Germany
    Posts
    146
    Vote Rating
    10
      0  

    Default

    Quote Originally Posted by Yoann M. View Post
    So, did you plan a new tutorial about MVC structure developpement using sencha 2 ?
    I hope so

    Have a look at the Ext JS 4 MVC tutorial. Its almost compatible?!

  3. #3
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751
    Vote Rating
    128
      0  

    Default

    replace Ext.regApplication with Ext.application.
    Best regards
    Tobias Uhlig

  4. #4
    Sencha User
    Join Date
    Mar 2011
    Posts
    21
    Vote Rating
    0
      0  

    Default

    Definitively not so simple in our case.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    11
      0  

    Default

    Hi Yoann,

    The MVC architecture in Touch 2.0 differs quite a bit from the one in 1.1. As others suggested you can follow the Ext JS 4 architecture guides and tutorials as they apply to Touch 2.0 as well. Here are three articles I wrote on the MVC architecture.

    http://www.sencha.com/learn/architec...xt-js-4-part-1
    http://www.sencha.com/learn/architec...xt-js-4-part-2
    http://www.sencha.com/learn/architec...xt-js-4-part-3

    You can also check out the source code for Twitter, Kiva and the Kitchensink, as they all use the new recommended MVC architecture.

  6. #6
    Sencha User
    Join Date
    Mar 2011
    Posts
    21
    Vote Rating
    0
      0  

    Default

    Thanks very much for the help !

  7. #7
    Sencha User edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    11
      0  

    Default

    We'll be creating way more documentation for the application architecture in the next couple of releases (just as we did for individual components and concepts this time round)
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  8. #8
    Touch Premium Member senchito's Avatar
    Join Date
    Aug 2011
    Location
    Montreal, QC
    Posts
    27
    Vote Rating
    0
      0  

    Default

    I just started the task of migrating.

    It looks like a big enough task since my project is already HUGE.

    Immediately upon switching the library from 1.1 to 2.0 I got a ton of error messages

    regApplication error
    regModel error
    regController error
    and about 200 Uncaught Error: [Ext.extend] Attempting to extend from a class which has not been loaded on the page.

    Now.. my question is this. Is the migration process basically going to entail JUST changing the way that I define my classes, controllers, models and the application itself? Following the way you define it in your Kitchensink MVC example?

    Or is it going to be a lot more than that?

    Things such as Ext.dispatch() for calling my controller actions. initComponent for applying my config parameters to my extended classes. And functionalities such as Ext.getCmp('MyCarousel').setActiveItem(x). Those will all continue to work right?

    Also regarding the orientation listener. I implemented a few "hacks" in my 1.1 application to remedy some bugs in regards to the playbook tablet and other anomalies. So as part of my Ext.regApplication() I was using this:

    Code:
    Ext.regApplication('App' {
        name         : 'App',
        useLoadMask : false,
    
    
        launch: function() {
            this.viewport = new app.views.Viewport({
                application: this
            });
            
            myMask = new Ext.LoadMask(Ext.getBody(), { msg:"Working..."} );
        },
        profiles: {
            PortraitPhone: function() {
                return Ext.is.Phone && Ext.orientation == ( (Ext.is.Playbook) ? 'landscape' : 'portrait' );
            },
            LandscapePhone: function() {
                return Ext.is.Phone && Ext.orientation == ( (Ext.is.Playbook) ? 'portrait' : 'landscape' );
            },
            PortraitTablet: function() {
                return !Ext.is.Phone && Ext.orientation == ( (Ext.is.Playbook) ? 'landscape' : 'portrait' );
            },
            LandscapeTablet: function() {
                return !Ext.is.Phone && Ext.orientation == ( (Ext.is.Playbook) ? 'portrait' : 'landscape' );
            }
        }    
    });
    But your MVC example uses a much simplied declaration:

    Code:
    Ext.application({
        name: 'Kitchensink',
        controllers: ['Main'],
        models: ['Demo']
    });
    can I still use my launch: and profiles: if I declare it with Ext.application ?

    And what's with the controllers and models... they have to be defined in my Ext.application now? Or can I just define them seperately like I did before and use the namespaces to properly refer to them?

  9. #9
    Sencha User edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    11
      0  

    Default

    @senchito seems I didn't do a great job communicating well enough that we're not expecting ST 1.x apps to work right now with the preview release. We have put a lot of effort into backwards compatibility with individual classes but not with larger things like MVC yet. For most code paths we can provide a decent compatibility bridge, for the rest we'll have a guide that explains what needs to be done.

    If you want to help us create that guide that would be great
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  10. #10
    Sencha User
    Join Date
    Sep 2011
    Posts
    125
    Vote Rating
    0
      0  

    Default

    Yeah, there is a quit a bit of structural changes that need to be made to port 1.0 to 2.0 it seems. Most of which have to do with using the Ext JS 4.0 definition of "classes". Also, using init for controllers and initialize for components. That seems to most of it, if you do not run into any bugs like I have. Than you can go the extra mile an start using control inside controllers to handle events, which is probably one of my favorite things so far. That said, it doesn't look like the structure of the HTML and CSS has changed much at all. It's merely the lower level structure of defining "classes", properties and initialization. There is also auto loading which I have not tackled yet considering the structure of my directories do not follow the standard. I have it turned off and will probably be overriding the auto loader to handle the way I have organized my application. Probably

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •