1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    55
    Answers
    3
    Vote Rating
    0
    brokentwig is on a distinguished road

      0  

    Default Answered: What role do controllers play

    Answered: What role do controllers play


    So I'm trying to get an good understanding of how controllers function withing Extjs. Let's say I have 1 controller and 3 views. Here is my code:

    app.js:
    Code:
    // enable and configure loader
    Ext.Loader.setConfig({enabled:true});
    
    Ext.application({
        name: 'MyIpSys', // Global namespace
        appFolder: 'app',
        
        controllers: [
            'LayoutController',
    
        ],    
        
        views    : [
            'layout.AppHeader',
            'layout.ListsContainer',
            'layout.ManagementArea',
        ],
    
        autoCreateViewport    : false,
            
        launch: function() {
           Ext.create('Ext.container.Viewport', {
                layout: 'border',
                items: [
                        { xtype: 'AppHeader' },
                        { xtype: 'ManagementArea' },
                        { xtype: 'ListsContainer' }
                    ]
            });
         
        }
    });
    Layout Controller:

    Code:
    Ext.define('MyIpSys.controller.LayoutController', {
        extend    : 'Ext.app.Controller',
        views    : [
            'layout.AppHeader',
            'layout.ListsContainer',
            'layout.ManagementArea',
        ],
    
        initComponent: function() {
    
        }
    
    });
    I won't show the views, cuz it doesn't matter. Lets say I create another controller, AnotherController.js, that is just a copy of LayoutController. I move 1 of the views from LayoutController to AnotherController and add 'anothercontroller' to the list of controllers in app.js. I don't change anything else. If I do this, the webpage loads blank. Firebug shows everything loading though. I'm missing something...

  2. Ok, I just walked through the whole process again, and it works just fine. I must have missed something last time.

  3. #2
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    514
    Answers
    31
    Vote Rating
    82
    existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice

      0  

    Default


    I'm assuming it was loading before the change?

    Can you post the new app.js code that you have, and the new controller that you created?

  4. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    55
    Answers
    3
    Vote Rating
    0
    brokentwig is on a distinguished road

      0  

    Default


    Yeah, it works just fine before I add a controller. Here are the changes I made:

    To app.js:

    From this:

    Code:
        controllers: [
            'LayoutController',
        ],
    To this:

    Code:
        controllers: [
            'LayoutController',
            'AnotherController',
        ],
    LayoutController:

    From this:

    Code:
    ...
        views    : [
            'layout.HeaderView',
            'layout.MenuView',
            'layout.ContentView',
        ],
    ...
    To this:

    Code:
    ...
        views    : [
            'layout.MenuView',
            'layout.ContentView',
        ],
    ...
    AnotherController is a dup of LayoutController, except the views section is this:

    Code:
    ...
        views    : [
            'layout.HeaderView',
        ],
    ...

    I literally copy and paste the LayoutController into AnotherController and delete two lines and change the names.

  5. #4
    Sencha User
    Join Date
    Aug 2011
    Posts
    55
    Answers
    3
    Vote Rating
    0
    brokentwig is on a distinguished road

      0  

    Default


    Ok, I just walked through the whole process again, and it works just fine. I must have missed something last time.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar