Results 1 to 4 of 4

Thread: Ext.class.requires won't load classes from a correct path

  1. #1
    Sencha User feiichi's Avatar
    Join Date
    Jul 2007
    Posts
    39

    Default Ext.class.requires won't load classes from a correct path

    Hello,

    I have lots of custom classes in my Ext JS project and they are all - let's say - in the "my_custom_classes/" directory and use "My." namespace. The namespace and the path are being picked up correctly by the bootstrap.js, so there is an entry like this:
    Code:
    "My": "my_custom_classes/"
    .

    When I require a custom class via Ext.require at the beginning of the app.js file, it works. When I use the "requires:" config attribute in the Ext.define block (without prior require via the Ext.require method), it tries to load the classes from a path relative to the "app/" directory. I haven't been able to figure out why it doesn't use the loader path.

    Is there anything I am missing on how the Ext.class.requires should work? Thank you!

  2. #2
    Ext Premium Member halcwb's Avatar
    Join Date
    Mar 2010
    Location
    Rotterdam
    Posts
    411
    Answers
    10

    Default

    Just a quick sanity check, you did enable the loader?

    Code:
    Ext.Loader.setConfig({
        enabled: true
    });

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    574
    Answers
    59

    Default

    If you use Ext.app.Aplication, it will override namespace path. Either configure it with appPath:Ext.Loader.getPath('my') or "paths processed":true.

  4. #4
    Sencha User feiichi's Avatar
    Join Date
    Jul 2007
    Posts
    39

    Default

    Thank you for your responses!

    I settled this with using the "overrides" folder (my custom classes are overrides or extends for the most parts) - then I don't have to require the classes one by one, although I must manually require any custom class that extends another custom class.

    The "overrides" folder, as it often happens to be with ext, isn't loaded automatically though because of a bug. I had to do some tweaks in the app and in the sencha cmd source:

    http://www.sencha.com/forum/showthre...t-Js-4.2/page2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •