-
15 Oct 2012 5:30 AM #1
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:
And then create the file MyApp/app/model/Dialog.js.Code:models: ['WebDialog']
Running sencha app build will result in an application that generates the following errors: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' } });
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.
-
15 Oct 2012 7:26 AM #2
+1
I have the same problem here. The behavior is the same with Sencha Cmd 3.0.0.201
-
16 Oct 2012 7:02 AM #3
I found a workaround
I added the require directive in the index.html file
But I think this is a real bug that need to be fix.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> -->
-
17 Oct 2012 6:45 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
Your model should use the requires array to require the association it needs.
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.
-
17 Oct 2012 7:06 AM #5
Thanks It's working. I don't know why I did not figure this by myself....
-
17 Oct 2012 3:34 PM #6
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]
-
17 Oct 2012 3:42 PM #7
I added the require that way
Same thing for HasManyCode:Ext.define('NL.model.TemplateChannel', { requires: ['Ext.data.association.BelongsTo'], extend: 'Ext.data.Model', fields: [ ... ], associations: [{ type: 'belongsTo', model: 'NL.model.AdminChannel' }] });
-
17 Oct 2012 4:26 PM #8
Thanks for your Reply!!
I am getting compilation error when i changed it to associations
Please help!!Code:requires:['MyApp.model.MyBranchList','Ext.data.association.HasMany'], ---- associations: [ { type: 'hasMany', model: 'MyApp.model.MyBranchList', name: 'branches', autoload : true } ]
-
17 Oct 2012 4:39 PM #9
it works.it was a syntax errror
Now some other problem....let me take a look
Thanks
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote