1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
    sciamannikoo is on a distinguished road

      0  

    Default Unanswered: Ext.plugin.ListPaging and Ext.plugin.PullRefresh duplicates items

    Unanswered: Ext.plugin.ListPaging and Ext.plugin.PullRefresh duplicates items


    Hello.

    I've found several posts talking about this issue, but none of them seems to be fully applicable to this specific case.

    I'm fetching data from a jsonp feed (similarly to what is done by the "Getting Started with Sencha Touch 2" guide).

    This works fine, but both Ext.plugin.ListPaging and Ext.plugin.PullRefresh plugins duplicates data when activated.

    As far as I've understood this is caused by the missing idProperty, but frankly I don't know how and where to set it from a feed.
    This feed doesn't have any ID, unless you would consider the title an ID and even in this case, I don't have a model where to set this ID, as the feed is not controlled by me.

    Here's the config section of my view:
    Code:
        config: {
            title: 'News',
            iconCls: 'star',
    
    
            items: {
                xtype: 'list',
    
    
                plugins: [
                    {
                        xclass: 'Ext.plugin.ListPaging', autoPaging: true
                    },
                    {
                        xclass: 'Ext.plugin.PullRefresh',
                        pullRefreshText: 'Pull down for more news!',
                        releaseRefreshText: 'Release to refresh...'
                    }
                ],
    
    
                emptyText: '<p class="no-searches">No news found</p>',
    
    
                itemTpl: Ext.create('Ext.XTemplate',
                    '<div class="news-item">',
                    '<span class="posted">{[this.posted(values.publishedDate)]}</span>',
                    '<h2>{author}</h2>',
                    '<p>{contentSnippet}</p>',
                    '</div>',
                    {
                        posted: timeAgoInWords
                    }
                ),
    
    
                title: 'Latest News',
    
    
                store: {
                    autoLoad: true,
                    fields: ['title', 'author', 'content', 'contentSnippet', 'publishedDate'],
    
    
                    proxy: {
                        type: 'jsonp',
                        url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www.beneventocalcio.it/index.php?format=feed&num=20',
                        reader: {
                            type: 'json',
                            rootProperty: 'responseData.feed.entries'
                        }
                    }
                }
            }
        }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    435
    Answers
    3108
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    There isn't a solid way to know what record to check if it exists on pull refresh. You need to have an id so it can know if the record exists or not.
    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.

Tags for this Thread