1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    39
    Vote Rating
    0
    shanlin is on a distinguished road

      0  

    Default Answered: sencha create jsb gives [Ext.Loader] Failed loading

    Answered: sencha create jsb gives [Ext.Loader] Failed loading


    We have couple ST 2.0 projects, and they all share certain common classes. So we concat common classes into an js called: 'architecture.js'. Here is some sample inside architecture.js:
    Code:
    Ext.define('Test.store.Base', {
      extend: 'Ext.data.Store',
        findExactRecord: function(field, attr) {
          return this.getAt(this.findExact(field,attr));
        }
    });
    Ext.define('Test.store.Settings', {
          extend: 'Test.store.Base',
        config: {
            model: 'Test.model.Setting',
            storeId: 'Settings',
            autoLoad: true,
            autoSync: true
        }
    });
    architecture.js is in the folder of ./scripts/.
    app.js looks like this:
    Code:
    Ext.Loader.setPath({
        'Ext': 'sdk/src'
    });
    Ext.application({
        name: 'TESSTime',
    
    
        requires: [
            'Ext.MessageBox',
            'Test.common.Settings',
            'appShared.common.Settings',
            'appShared.utility.DltkWriter'
       ],
    ...
    My app.json looks like this:
    Code:
    // ...
        "js": [
            {
                "path": "sdk/sencha-touch.js"
            },
            {
                "path": "scripts/architecture.js",
                "update": "delta"
            },
            {
                "path": "scripts/tessshared.js",
                "update": "delta"
            },
            {
                "path": "app.js",
                "bundle": true,  /* Indicates that all class dependencies are concatenated into this file when build */
                "update": "delta"
            }
        ],
    // ...
    When I do 'sencha create jsb -a ./index.html -p app.jsb3, it gives error:
    Code:
    Error thown from your application with message: Error: [Ext.Loader] Failed loading 'Test/store/Base.js', please verify that the file exists.
    If I commented out the class definition of Test.store.Settings in architecture.js, it works fine.
    I thought since Test.store.Base is defined before Test.store.Settings. The class loader should find it. Can anyone shed some lights on what is the problem?

    Thanks

  2. Instead of loading a separate JS file, I would have each class in it's own file. I would then set a path for the common classes who have their own namespace. And then require the classes I need.

  3. #2
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    39
    Vote Rating
    0
    shanlin is on a distinguished road

      0  

    Default


    One more note. If I commented out app.js section in the app.json, it gives the same error. Any idea?

  4. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    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


    Instead of loading a separate JS file, I would have each class in it's own file. I would then set a path for the common classes who have their own namespace. And then require the classes I need.
    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. #4
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    39
    Vote Rating
    0
    shanlin is on a distinguished road

      0  

    Default


    Thanks Mitchell. That certainly works. I was trying to see if combining them into one JS works.

Thread Participants: 1

Tags for this Thread