You found a bug! We've classified it as EXTJS-7665 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    51
    Vote Rating
    3
    extjs@kingsquare.nl is on a distinguished road

      0  

    Exclamation Ext.app.Controller.views are not loaded by Application

    Ext.app.Controller.views are not loaded by Application


    REQUIRED INFORMATION


    Ext version tested:
    • Ext 4.0.7, 4.1.2 and 4.1.3

    Browser versions tested against:
    • Chrome
    • IE
    • FF

    DOCTYPE tested against:
    • HTML5

    Description:
    • When defining 'views' on a controller, and that controller would be used in an Application, one would expect it would by loaded BEFORE the Application.launch() callback. As stated in several comments in the manual, this isn't the case.

    Steps to reproduce the problem:
    Load up an Application with a Controller with a View, where the view is declared in the views-property on the controller. Note how the view is not available after launch so JavaScript breaks.

    The result that was expected:
    A working application

    The result that occurs instead:
    A JavaScript error because the view-class isn't loaded

    Test Case:
    app/app.js
    Code:
    Ext.application({
        controllers: [
    		'MyController'
    	],
    
        name: 'myApp',
    	launch: function () {
    		//this is undefined, but should be the view
    		console.log(myApp.view.MyView);
    	}
    })
    controller/MyController.js
    Code:
    Ext.define('myApp.controller.MyController', {
    	extend: 'Ext.app.Controller',
    	views: ['MyView']
    });
    view/MyView.js
    Code:
    Ext.define('myApp.view.MyView', {
    	extend: 'Ext.panel.Panel'
    });

    HELPFUL INFORMATION

    At this moment, one can work around this issue by adding the views to the 'requires'-property on the controller, but this is annoying.

    Earlier versions of ExtJs (e.g. 4.0.2a) didn't have this issue)
    Last edited by extjs@kingsquare.nl; 31 Oct 2012 at 1:03 AM. Reason: typo

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,927
    Vote Rating
    636
    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


    I can't reproduce this. Drop the attached folder under /examples in 4.1.3, it logs the view as I'd expect.
    Attached Files
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    51
    Vote Rating
    3
    extjs@kingsquare.nl is on a distinguished road

      0  

    Default


    Hi Evan,

    Thank you for finding time to look into this!

    I'm trying to narrow down our project to pinpoint the cause of the issue. In our project we still have to add all Ext.app.Controller.views and Ext.app.Controller.models to the Ext.app.Controller.requires by hand to make stuff work.

    My idea was to add some more requirements to the controller in the example you sent, to test the loading of dependencies. However i stranded after adding a simple Model. (Of course this might be fixed by adding Ext.require() for some classes above my App, but shouldn't this work out of the box?)

    Uncaught TypeError: Expecting a function in instanceof check, but got [object Object] Header.js:471
    Attached Files

Thread Participants: 1

Tags for this Thread