Results 1 to 2 of 2

Thread: readRecords fails with empty json objects on iOS

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    77
    Vote Rating
    2
      0  

    Default readRecords fails with empty json objects on iOS

    Sencha Touch version tested:
    • 1.1.1
    Platform tested against:
    • iOS 5.x
    • iOS 5 Simulator
    • Chrome
    Description:
    • when returning an empty element in json, readRecords in Ext.data.Reader fails
    Chrome seems to be tolerant of this, but iOS with phonegap/cordova isn't. Throws
    Code:
    TypeError: 'undefined' is not an object
    Fix:
    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({

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    This seems to be fixed in Sencha Touch 2
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •