Results 1 to 4 of 4

Thread: Extjs.application, Ext.require, Ext.Loader - no automatic loading, with Ext.require

  1. #1
    Sencha User
    Join Date
    Feb 2010
    Posts
    27

    Default Extjs.application, Ext.require, Ext.Loader - no automatic loading, with Ext.require

    The problem:

    Ext.application loads all controllers, automaticly, as long if the controller have no 'requires' or 'uses' property. Or a Ext.require is given before running the Ext.application code. As long the Ext.application runs without requires, all controller runs their 'init' functions. After given a 'require' it will never run this.

    For example:

    PHP Code:
    Ext.Loader.setConfig({
        
    enabled:true,
        
    paths:{
            
    Editor:'app'
        
    }
    });

    Ext.application({
        
    name:'AppName',
        
    appFolder:'app',
        
    autoCreateViewport:false,
        
    controllers:['MyController'],
        
    launch:function () {
            
    console.log('Launch App');
        }
    }); 
    Runs the MyController init function. But if I do this:

    PHP Code:
    Ext.Loader.setConfig({
        
    enabled:true,
        
    paths:{
            
    Editor:'app'
        
    }
    });

    Ext.require('Load.SomethingElse');

    Ext.application({
        
    name:'AppName',
        
    appFolder:'app',
        
    autoCreateViewport:false,
        
    controllers:['MyController'],
        
    launch:function () {
            
    console.log('Launch App');
        }
    }); 
    The controller is not running, even the launch function will not run. What is the problem, and how can I fix this? I don't understand why here is a mistake, should it not be possible to load any extra stuff manual - if I want to - and load everything else like expected automaticly? Thanks for help (PS: I studied the http://www.sencha.com/blog/using-ext...r-application/ but it was not helpful in this manner).

  2. #2
    Sencha User
    Join Date
    Apr 2009
    Location
    London
    Posts
    118
    Answers
    7

    Default

    Try and put your loader code and the require within the Ext.onReady event:

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

  3. #3
    Sencha User
    Join Date
    Feb 2010
    Posts
    27

    Default ExtJS Application vs. Ext.require

    This sound too good to be true, but it didn't help.
    When I use requires : ['load.me.something'] in the Controller, no init function (controller) or launch (application) will be triggered. But the thing was definitely loaded.

    THE SOLUTION: I uses a wrong namespace, the file was loaded correctly, but the namespace in the define part was'nt correct. Finding the bug was very hard.
    Last edited by webxells; 2 Jul 2012 at 2:58 AM. Reason: mistake

  4. #4
    Sencha User
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106

    Default

    I've been bitten by this same problem. Also, if you copy/paste a store or model and forget to change the defined class name, you'll also get a big, pretty, white, blank page and no error message/stack trace.

    This REALLY needs to be addressed...

Posting Permissions

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