1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
    fmuke is on a distinguished road

      0  

    Default Answered: ext js 4 MVC tutorial do not work ...

    Answered: ext js 4 MVC tutorial do not work ...


    ok ... for some reason the code that i get from the EXT JS 4 MVC architecture do not work.

    i can't load the controller ... i don't understand why ... please help.

    need to use controller for it won't work at all !!!
    app.js
    --------
    Ext.application({
    name: 'AM',
    appFolder: 'app',
    controllers: ['AM.controller.Users'], // ---> if i remove this, it will work but i wont have a controller
    launch: function () {
    var me = this;
    Ext.create('Ext.container.Viewport', {
    layout: 'fit',
    items: [
    {
    xtype: 'panel',
    title: 'Users',
    html: 'List of users will go here'
    }
    ]
    });
    console.log('hello from app.js');

    }
    });

    controller
    ------------
    Ext.define('AM.controller.Users', {
    extend: 'Ext.app.Controller',

    init: function () {
    console.log('hello1 from controller Users.js');
    this.control({
    'viewport > panel': {
    render: this.onPanelRendered
    }
    });
    },

    onPanelRendered: function () {
    console.log('hello2 from controller Users.js');
    }
    });

  2. thank you guys for your help ....
    i found the annoying problem ...
    Ext.Loader.setConfig({enabled: true});

    Ext.require('Ext.container.Viewport');

    Ext.application({
    name: 'App',

    appFolder: '/NUKEAPPS/app', //<---here is the mistake . i needed to specify the app right location

    controllers: ['Books'],

    launch: function() {

    console.log('called function launch - application');

    Ext.create('Ext.container.Viewport', {
    layout: 'fit',
    items: [
    {
    xtype: 'panel',
    title: 'Books',
    html : 'List of books will be displayed here'
    }
    ]
    });
    }
    });

  3. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
    fmuke is on a distinguished road

      0  

    Default


    this is the example on EXT JS 4 MVC architecture from this website...
    im learning ext js ... and when trying the example... everything work except the controller ...

  4. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,008
    Answers
    465
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    From the docs:

    Ext.application({
    ...

    controllers: [
    'Users'
    ],

    ...
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #4
    Sencha User
    Join Date
    Aug 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
    fmuke is on a distinguished road

      0  

    Default


    --- i did tried the cold below but it does t work ... i doesn't call the controller since the console.log do note send the message... been trying...still nothing

    Ext.application({
    name: 'AM',
    appFolder: 'app',
    controllers: ['Users'],

    launch: function () {
    var me = this;

    Ext.create('Ext.container.Viewport', {
    layout: 'fit',
    items: [
    {
    xtype: 'panel',
    title: 'Users',
    html: 'List of users will go here'
    }
    ]
    });
    console.log('hello from app.js');

    }
    });

  6. #5
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    @fmuke,

    I have tried to run your code with Ext 4.1.1 and Chrome browser and it works well. I think, your problem is that the Users controller could not be loaded. So try to check the filename and pathname of Users controller. Make sure its pathname is ".../app/controller/Users.js"

  7. #6
    Sencha User
    Join Date
    Aug 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
    fmuke is on a distinguished road

      0  

    Default


    tks for the help ...
    were u able to get a the message "console.log('hello2 from controller Users.js');"


  8. #7
    Sencha User
    Join Date
    Aug 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
    fmuke is on a distinguished road

      0  

    Default Find the problem

    Find the problem


    thank you guys for your help ....
    i found the annoying problem ...
    Ext.Loader.setConfig({enabled: true});

    Ext.require('Ext.container.Viewport');

    Ext.application({
    name: 'App',

    appFolder: '/NUKEAPPS/app', //<---here is the mistake . i needed to specify the app right location

    controllers: ['Books'],

    launch: function() {

    console.log('called function launch - application');

    Ext.create('Ext.container.Viewport', {
    layout: 'fit',
    items: [
    {
    xtype: 'panel',
    title: 'Books',
    html : 'List of books will be displayed here'
    }
    ]
    });
    }
    });