Hybrid View
-
9 Jul 2012 3:31 AM #1
readRecords fails with empty json objects on iOS
readRecords fails with empty json objects on iOS
Sencha Touch version tested:
- 1.1.1
- iOS 5.x
- iOS 5 Simulator
- Chrome
- when returning an empty element in json, readRecords in Ext.data.Reader fails
Fix:Code:TypeError: 'undefined' is not an object
Code:--- a/www/lib/touch/sencha-touch-debug-w-comments.js +++ b/www/lib/touch/sencha-touch-debug-w-comments.js @@ -15541,7 +15541,7 @@ Ext.data.Reader = Ext.extend(Object, { data = this.getData(data); var root = this.getRoot(data), - total = root.length, + total = root ? root.length : 0, success = true, value, records, recordCount; @@ -15559,7 +15559,7 @@ Ext.data.Reader = Ext.extend(Object, { } } - records = this.extractData(root, true); + records = root ? this.extractData(root, true) : []; recordCount = records.length; return new Ext.data.ResultSet({
-
9 Jul 2012 6:25 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
This seems to be fixed in Sencha Touch 2
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.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote