-
15 Sep 2012 6:55 AM #1
Ext.application models config array does not actually load models.
Ext.application models config array does not actually load models.
Although this isn't a huge issue, I don't believe that adding the Model class to the models config array actually loads the Model.js class.
It only loads the model class, if you place a Store in the stores config array that references that model.
The only way this works is to explicitly add the Model.js in the requires config array.
Again, this is not a huge issue, but it doesn't work.
In the code below, the model class is never loaded, and I get an error:
app.js:
index.html:Code:Ext.Loader.setConfig({ enabled: true }); Ext.application({ name: 'Test', models: ['SomeModel'], launch: function() { var someModel = this.getModel('SomeModel'); someModel.load(1, { success: function(model) {console.log(model); // error: Uncaught TypeError: Cannot call method 'load' of undefined }} });
SomeModel.js:Code:<html> <head> <title>Test</title> <link href="../extJS/resources/css/ext-all.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="../extJS/ext-debug.js"></script> </head> <body></body> <script type="text/javascript" src="app.js"></script> </html>
somemodeldata.json:Code:Ext.define('Test.model.SomeModel', { extend: 'Ext.data.Model', fields: [ {name: 'id', type: 'string'}, {name: 'last_name', type: 'string'}, {name: 'first_name', type: 'string'} ], proxy: { type: 'ajax', url: 'testdata/somemodeldata.json', reader: { type: 'json', root: 'data' } } });
Code:{ "success": true, "data": [ {"id": 1, "last_name": "Castro", "first_name": "Frank"}, {"id": 2, "last_name": "Bower", "first_name": "Kelly"} ] }Frank Castro
-
19 Sep 2012 11:20 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
Thank you for the report.
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.
-
27 Sep 2012 9:07 AM #3
FYI this seems to be more of an issue in IE.
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-7250
in
4.1.3 Sprint 1.


Reply With Quote