Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-7308 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Eindhoven
    Posts
    115
    Vote Rating
    2
    damien is on a distinguished road

      0  

    Default [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
    Description:
    • 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
    Steps to reproduce the problem:
    • 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
    The result that was expected:
    • ...
    The result that occurs instead:
    • Fails during class creation
    Test Case:

    Code:
    Ext.define('MyApp.a.name.space.MyController', {
       extend: 'Ext.app.Controller'
    
    });
    Ext.application({
       appName: 'MyApp',
       controllers: [ 'MyApp.a.name.space.MyController' ]
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,633
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Eindhoven
    Posts
    115
    Vote Rating
    2
    damien is on a distinguished road

      0  

    Default


    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

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,633
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    506
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default


    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

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,633
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  7. #7
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    506
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default


    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:

    Code:
    Ext.define('A', {
    requires: 'B'
    });
    Ext.define('B', {});
    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'.

    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.

Thread Participants: 2