-
18 Sep 2012 5:59 PM #1
[4.1.2] Controller classes not in a 'controller' namespace fail during class creation
[4.1.2] Controller classes not in a 'controller' namespace fail during class creation
REQUIRED INFORMATION
Ext version tested:- 4.1.2
- A custom class extending from Ext.app.Controller in a namespace that does **not** follow the pattern /^(.*)\.controller\./ will fail during class creation in Ext.app.Controller#onClassExtended
- Create a custom controller class, extending Ext.app.Controller
- in a namespace that does not include 'controller' before the class name, e.g. MyApp.a.name.space.MyController
- ...
- Fails during class creation
Code:Ext.define('MyApp.a.name.space.MyController', { extend: 'Ext.app.Controller' }); Ext.application({ appName: 'MyApp', controllers: [ 'MyApp.a.name.space.MyController' ] });
-
18 Sep 2012 7:05 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
If the controller is in it's own file it will work. The reason is because it needs to have the path set for the appName and at the time the Ext.define is fired for your controller, the path isn't setup because Ext.app.Application hasn't been created either.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Sep 2012 7:26 PM #3
It is correct that it will work in a development setup with Ext.Loader configured.
It will not work in a production setup.
This bug was introduced in 4.1.2, it worked in 4.1.1
-
18 Sep 2012 8:22 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
Looking at the code, isn't all the code in the onClassExtended for development? It sets up what should go in the Ext.require which should all be loaded already in a production build.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
19 Sep 2012 3:36 AM #5
That's a good point. What is the relevance of dependencies in a production scenario with all javascript sources loaded manually and Ext.Loader disabled? Does it still affect the class loading system?
I guess it does because dependencies are not only relevant as a means of loading file resources, they also affect the class loading (=creation) order I would assume. That is probably more true for a class that defines dependencies via 'requires' than it is for dependencies defined via 'uses' or plain 'Ext.require' statements.
However, this assumption is rather based on logical conclusions derived from how other class dependency loading schemes work than it is based on knowledge of the actual implementation of Ext.ClassManager
-
19 Sep 2012 4:36 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
When doing a build, it of course will look at all the classes required and will build them into 1 file. You then include that file in the production index.html (or whatever you use) and when that file is loaded by the browser the classes are defined. They are now ready to have instances created.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
19 Sep 2012 7:19 PM #7
It seems that Ext.define goes straight through to Ext.Loader for dependency loading. If Ext.Loader is disabled, a missing dependency will cause the class loading to fail.
This will fail:
While it might seem obvious that this is not going to work, it could as well have been supported assuming that classes will only be available in 'Ext.onReady'. Classes with missing dependencies could be queued until the dependency is available. A missing dependency would cause a failure only if not resolved until 'documentReady'.Code:Ext.define('A', { requires: 'B' }); Ext.define('B', {});
However, I don't want to imply that this is a desired feature. I was merely openly thinking about the behavior of Ext.ClassManager in a production environment.
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-7308
in
4.1.3 Sprint 1.


Reply With Quote