View Full Version : [OPEN] Ext.app.Controller.views are not loaded by Application

31 Oct 2012, 12:52 AM

Ext version tested:
Ext 4.0.7, 4.1.2 and 4.1.3

Browser versions tested against:
Chrome IE FF

DOCTYPE tested against:

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:

controllers: [

name: 'myApp',
launch: function () {
//this is undefined, but should be the view


Ext.define('myApp.controller.MyController', {
extend: 'Ext.app.Controller',
views: ['MyView']


Ext.define('myApp.view.MyView', {
extend: 'Ext.panel.Panel'


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)

31 Oct 2012, 1:21 AM
I can't reproduce this. Drop the attached folder under /examples in 4.1.3, it logs the view as I'd expect.

1 Nov 2012, 8:25 AM
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