1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    33
    Vote Rating
    2
    LarssaAndin is on a distinguished road

      0  

    Default Failed to find association/belongsto

    Failed to find association/belongsto


    I've started to use the sencha command for my now fairly big project (should have started earlier but hey, better late then never ;-)). I've created my all-classes.js using sencha app build
    Anyway, I get issues with my models due to missing the BelongsTo and HasMany associations.
    When load my app it tries to find the file http://localhost/association/belongsto.js.
    I get the error [Ext.Loader] Failed loading 'association/belongsto.js', please verify that the file exists from all-classes.js

    I created a simple example where I just add a model to the generated app using:
    sencha generate app MyApp /path/to/MyApp

    In Main.js I just add this line:
    Code:
    models: ['WebDialog']
    And then create the file MyApp/app/model/Dialog.js.
    Code:
    Ext.define('MyApp.model.Dialog', {
        extend:'Ext.data.Model',
       // require: 'MyApp.model.Row', // Skipping require to avoid need of that file in this example code
        fields:[
            {name:'id', type:'int'}
        ],
    
        hasMany:{
            model:'MyApp.model.Row', // Row model doesn't exist, but that is not relevant for this issue
            name:'rows'
        }
    });
    Running sencha app build will result in an application that generates the following errors:
    Uncaught Error: [Ext.Loader] Failed loading 'association/hasmany.js', please verify that the file exists all-classes.js:1
    Uncaught Error: [Ext.Loader] Failed loading 'MyApp/model/Dialog.js', please verify that the file exists

    Looking at the all-classes.js I see that it's correct that the hasmany code hasn't been added. I tried adding an explict requires in the app.js to just force the inclusion of this code and it is then added but it doesn't remove the problem.

    What can I do to get around this problem?

    Versions used:
    ExtJS 4.1.2a
    Sencha Command v3.0.0.190.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2012
    Posts
    7
    Vote Rating
    3
    l1ndroid is on a distinguished road

      0  

    Default


    +1

    I have the same problem here. The behavior is the same with Sencha Cmd 3.0.0.201

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2012
    Posts
    7
    Vote Rating
    3
    l1ndroid is on a distinguished road

      0  

    Default


    I found a workaround

    I added the require directive in the index.html file

    Code:
        <!-- <x-compile> -->
            <!-- <x-bootstrap> -->
                <script src="ext/ext.js"></script>
                <script src="bootstrap.js"></script>
            <!-- </x-bootstrap> -->
            <script type="text/javascript">
                //@require Ext.data.association.*
            </script>
            <script src="app/app.js"></script>
        <!-- </x-compile> -->
    But I think this is a real bug that need to be fix.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Vote Rating
    834
    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


    Your model should use the requires array to require the association it needs.
    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 Premium Member
    Join Date
    Sep 2012
    Posts
    7
    Vote Rating
    3
    l1ndroid is on a distinguished road

      0  

    Default


    Thanks It's working. I don't know why I did not figure this by myself....

  6. #6
    Ext JS Premium Member
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    1
    hsingh11 is on a distinguished road

      0  

    Default not working even with 'require'...

    not working even with 'require'...


    Not working for me, what else could be ?
    I had require in the model

    Code:
      requires:['MyApp.model.MyList'],  
    [
    ....
    ]
     hasMany  : [{model: 'MyApp.model.MyList', name: 'offices', autoload : true },

    • [COLOR=red !important]Uncaught Error: [Ext.Loader] Failed loading 'Cars/model/MyList.js', please verify that the file exists all-classes.js:10092[/COLOR]

    • [COLOR=red !important]Uncaught Error: [Ext.Loader] Failed loading 'association/belongsto.js', please verify that the file exists [/COLOR]

  7. #7
    Sencha Premium Member
    Join Date
    Sep 2012
    Posts
    7
    Vote Rating
    3
    l1ndroid is on a distinguished road

      0  

    Default


    I added the require that way

    Code:
    Ext.define('NL.model.TemplateChannel', {
        requires: ['Ext.data.association.BelongsTo'],
        extend: 'Ext.data.Model',
        fields: [
              ...
        ],
        associations: [{
            type: 'belongsTo',
            model: 'NL.model.AdminChannel'
        }]
    });
    Same thing for HasMany

  8. #8
    Ext JS Premium Member
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    1
    hsingh11 is on a distinguished road

      0  

    Default


    Thanks for your Reply!!

    I am getting compilation error when i changed it to associations

    Code:
    requires:['MyApp.model.MyBranchList','Ext.data.association.HasMany'],
    ----
      associations: [
         { type: 'hasMany', model: 'MyApp.model.MyBranchList', name: 'branches', autoload : true }
        ]
    Please help!!

  9. #9
    Ext JS Premium Member
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    1
    hsingh11 is on a distinguished road

      0  

    Default


    it works.it was a syntax errror
    Now some other problem....let me take a look Thanks

  10. #10
    Sencha User
    Join Date
    Mar 2013
    Location
    Gdańsk, Poland
    Posts
    1
    Vote Rating
    0
    woyteck is on a distinguished road

      0  

    Default


    I had the same problem. I had to put require 'Ext.data.association.*' inside main application class to make it work.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi