-
31 Oct 2012 12:52 AM #1
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
controller/MyController.jsCode:Ext.application({ controllers: [ 'MyController' ], name: 'myApp', launch: function () { //this is undefined, but should be the view console.log(myApp.view.MyView); } })
view/MyView.jsCode:Ext.define('myApp.controller.MyController', { extend: 'Ext.app.Controller', views: ['MyView'] });
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
-
31 Oct 2012 1:21 AM #2
I can't reproduce this. Drop the attached folder under /examples in 4.1.3, it logs the view as I'd expect.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
1 Nov 2012 8:25 AM #3
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
You found a bug! We've classified it as
EXTJSIV-7665
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.



Reply With Quote