1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    10
    Vote Rating
    0
    runfaj is on a distinguished road

      0  

    Default Unanswered: ext-record-# on list for empty server response

    Unanswered: ext-record-# on list for empty server response


    Hi all,

    I have a couple issues that I found both somewhat related.

    First one: I make a list and do a manual ajax request (Ext.Ajax.request) to get data. If the json response gives [] and I pass that to the list's data config, it will give a reader error. I can fix this by passing it null if the array is empty. Any ideas why this is?

    Second one: I make a list that is backed by a store. My store is configured with an ajax proxy and json reader. I do something like view.down('list').getStore().load(). If the json response gives anything, it works great. If it gives the empty array response (like above), it puts an "ext-record-#" as the only item in my list. Any suggestions?

    Thanks in advance.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,541
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Do you have an id field configured or any value returning in the id property?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    10
    Vote Rating
    0
    runfaj is on a distinguished road

      0  

    Default


    yes, I never go without an idProperty (learned that the hard way with Ext).

    Also for further clarification, my default empty json response looks like this:

    {success:"true", total: 0, payload:[]}

    And both issues in my original problem are not issues when there is data in the payload. e.g.:

    {success:"true", total: 0, payload:[{something:"blah", id:1},{something:"blah 2", id:2}]}

  4. #4
    Sencha User anthonyterrell's Avatar
    Join Date
    Mar 2012
    Location
    Albany, NY
    Posts
    30
    Vote Rating
    0
    anthonyterrell is on a distinguished road

      0  

    Default Similar issue

    Similar issue


    I am having a similar issue. I am attempting to reach out to Flickr and pull in 5 images. At this point I am just trying to display the data instead of using an xtemplate, just to ensure it's working.

    This list is part of a carousel container.
    Code:
    xtype: 'list',
    
    
            items: {
                xtype: 'toolbar',
                docked: 'top',
                title: 'Flickr'
            },
    
    
            store: {
              model: 'app.model.flickr',
              autoLoad: true,
              storeId: 'flickr',
    
    
              proxy: {
                type: 'ajax',
                url: 'http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=MY_API_KEY&user_id=38799934%40N02&safe_search=1&per_page=5&format=json&nojsoncallback=176029f1357a0f0e19811cbf094e253ac',
    
    
                reader: {
                  type: 'json',
                  rootProperty: 'photos'
                },
    
    
                fields: [
                  {
                    name: 'id'
                  },
                  {
                    name: 'user'
                  }
                ]
              }
            },
    
    
            itemTpl: '<div>{id}{user}</div>'
    Any help would be greatly appreciated!

    Thanks
    Anthony Terrell - Developer
    [twitter] - [forrst]