-
29 Oct 2012 6:15 AM #1
[4.1.3] Missing dependencies for Ext.data.Model
[4.1.3] Missing dependencies for Ext.data.Model
REQUIRED INFORMATION
Ext version tested:- Ext 4.1.0
- Ext 4.1.2
- Ext 4.1.3
Browser versions tested against:- Firefox 16
Description:- Creating an instance of a class that derives from Ext.data.Model requires both 'Ext.data.reader.Json' and 'Ext.data.writer.Json' by default (as they are the default reader and writer) but these are not required by Ext.data.Model.
Steps to reproduce the problem:- Create an instance of a class that inherits from Ext.data.Model without first loading the JSON reader or writer classes
The result that was expected:- The reader and writer classes are in the list of dependencies for Ext.data.Model
The result that occurs instead:- The reader and writer classes are not in the list of dependencies and Ext.Loader attempts to synchronously load them. This doesn't work when synchronous loading is disabled.
- In particular, when trying to 'build' and compress our javascript into a single file using the Sencha SDK tools, the reader and writer classes aren't put in the right place in the file, causing our site to fail to load.
Test Case:
The following just creates a grid property model (just as a class that inherits from Ext.data.Model). Nothing to see except the warning messages in the console.
Code:<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Json Reader/Writer Test</title> <script type="text/javascript" src="/ext4.1.3/ext-dev.js"></script> <link rel="stylesheet" href="/ext4.1.3/resources/css/ext-all.css" type="text/css"> <script type="text/javascript"> Ext.require([ 'Ext.data.Model', 'Ext.grid.property.Property' ]); Ext.onReady(function(){ Ext.create('Ext.grid.property.Property'); }); </script> </head> <body> </body> </html>
HELPFUL INFORMATION
Debugging already done:- It looks like this has been a problem prior to 4.1.3 but have only noticed it on upgrading to 4.1.3 so possibly another class was loading the reader and writer previously...
- Get the following warning in the console (and an equivalent one for the writer):
[Ext.Loader] Synchronously loading 'Ext.data.reader.Json'; consider adding Ext.require('Ext.data.reader.Json') above Ext.onReady
Possible fix:- Add reader and writer classes to list of dependencies for Ext.data.Model
-
29 Oct 2012 2:44 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
The model shouldn't require it, the proxy should. The reader/writer isn't used on the model, it's used on the proxy.
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.
-
30 Oct 2012 12:43 AM #3
Fair point. Can the proxy require the reader/writer then please?
-
21 May 2013 12:38 AM #4
This is now fine in 4.2.1.744
Product Architect
Altus Ltd.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote