Results 1 to 4 of 4

Thread: MVC revisited...

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Answers
    4

    Exclamation MVC revisited...

    Now that PR3 is out, I thought I'd revisit MVC so I read the document "MVC Application Architecture" which is part of ExtJS. I have read several posts here on this forum that state that the MVC in Sencha Touch is the same/similar as ExtJS so this documentation should be valid.

    ExtJS MVC
    http://docs.sencha.com/ext-js/4-0/#!...n_architecture

    I am trying to create a simple MVC app (which I will try to share with all of you) because it is one of the more glaringly obvious missing examples in Sencha Touch. There's Kiva and such but that's not what new ST devs are looking for. (Hint: This is feedback for the Sencha team for improvement...)

    PROBLEM #1 (in a series of problems to be continued as I get answers to each problem...)

    So I pulled this from the documentation (change it slightly) but it does not work - blank screen. Why?

    Code:
    Ext.application({
        name: 'MyMVC',
    	requires: ['Ext.container.Viewport'],
    
    
        launch: function() {
            console.log('launch:');
            Ext.create('Ext.container.Viewport', {
                layout: 'fit',
                items: [
                    {
                        xtype: 'panel',
                        title: 'Users',
                        html : 'List of users will go here'
                    }
                ]
            });
        }
    });

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Posts
    52
    Answers
    2

    Default

    Hi,

    do you see the logging output?
    Maybe you have to enable the loader.
    Here is my app.js

    Code:
    function mainLaunch(){
        Ext.Loader.setConfig({ enabled: true });
    
    
        Ext.application({
            name: 'MyApp',  
            appFolder: 'app',
            models: ['Customer'],
            controllers: ['MainController','ProfileController']    ,
        });
    }
    In the init method of my MainController im loading my main view

    Code:
        refs: [
            {
                ref     : 'Main',
                selector: 'mainview',
                autoCreate: true,
                xtype   : 'mainview'
            },
    
    ....
    
        init: function() {
    
    this.getMain();
    
    ...
    the getMain(); will only work if you set autoCreate: true, otherwise you have to create this view by your own. In my app main is tab panel with different tabs.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Answers
    4

    Default

    Adding " Ext.Loader.setConfig({ enabled: true });" does NOT work unfortunately and there is no console output.

  4. #4
    Sencha User
    Join Date
    Oct 2011
    Location
    Germany
    Posts
    146
    Answers
    4

    Default

    Code:
    Ext.setup({
    
        onReady: function() {
            console.log('launch:');
            Ext.create('Ext.Panel', {
                fullscreen: true,
                html: 'Hello World'
            });
        }
    });
    works.

    The docs are not up to date yet:
    http://docs.sencha.com/touch/2-0/#!/api/Ext.app.Application

Posting Permissions

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