Results 1 to 9 of 9

Thread: problem with Extjs 4.1 documentation

  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    41

    Default Answered: problem with Extjs 4.1 documentation

    Hi
    Im new to Extjs 4.1

    when I add
    controllers:['Users'],
    to my app.js I got this error :
    Uncaught TypeError: Object Ext.container.Viewport has no method 'push'

    I read some where to add
    require : AM.controller.Users
    so I added this line :
    requires:['Ext.container.Viewport',AM.controller.Users],
    to my app.js
    but I got this error
    Uncaught Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class: AM.controller.Users

    below are my related files

    my controller/Users.js file

    Ext.define('Am.controller.Users' , {

    extend :'Ext.app.Controller',

    init :function(){
    console.log("initilize users");
    }

    });

    and my app.js file

    Ext.application({
    requires:['Ext.container.Viewport','AM.controller.Users'],
    name: 'AM',
    appFolder :'app',

    controllers:['Users'],


    launch: function () {

    Ext.create('Ext.container.Viewport' , {
    layout :'fit',
    items: [
    {
    xtype :'panel',
    title :'Users',
    html :'List of user will go here '
    }
    ]
    });
    }






  2. It seems that you have an typo in declaring the fullname of Users controller. Try to fix it as below:
    Code:
    Ext.define('AM.controller.Users' , { 
        ...
    });

  3. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    347

    Default

    Try to enable dynamic class loading by setting enabled of Ext.Loader to true
    Code:
    Ext.Loader.setConfig({
        enabled: true,
        ...
    });

  4. #3
    Sencha User
    Join Date
    May 2012
    Posts
    41

    Default

    tnx for your replay

    I add

    Ext.Loader.setConfig({
    enabled: true,
    path:{
    'Ext':'extjs-4.1.0/src',
    'AM' :'app'
    }

    });


    Ext.require([
    'Ext.container.Viewport',
    'AM.controller.Users',

    ]

    but I got this error :

    GET file:///home/nima/Aptana%20Studio%20...=1337402645080




    It seems loader can not load my AM.controller.Users

    my project file organization :
    AM
    • app
    • index.html
    • app.js
    my app folder contains controller folder which contains Users.js

  5. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    347

    Default

    It seems that you have an typo in declaring the fullname of Users controller. Try to fix it as below:
    Code:
    Ext.define('AM.controller.Users' , { 
        ...
    });

  6. #5
    Sencha User
    Join Date
    May 2012
    Posts
    41

    Default

    Hmmmmmmmmmm

    tnx alot

  7. #6
    Sencha User
    Join Date
    May 2012
    Posts
    1

    Default

    I received the same error (... no method 'push') and solved it by putting the requires value in brackets:

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

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

    Hope that helps.

  8. #7

    Default It should be an array

    Thank you

  9. #8
    Sencha User
    Join Date
    Jun 2011
    Posts
    6

    Default

    This solution worked for me. Thanks. I noticed that the documentation in the download does not include the brackets, but the documentation online does. It's probably a good idea to use the online docs since they are different.

  10. #9
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    1

    Default The "MVC Application Architecture" sample under "Concepts" does not work as written.

    Thank you for this thread, it is very frustrating as a noob trying to work through your first ext js application by pasting in the examples when they don't work as written. Adding the line below fixed it for me too:

    Ext.Loader.setConfig({ enabled: true });

Tags for this Thread

Posting Permissions

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