1. #1
    Sencha User kenono's Avatar
    Join Date
    Jun 2012
    Location
    Liverpool, UK
    Posts
    13
    Vote Rating
    1
    kenono is on a distinguished road

      0  

    Default Unanswered: ListPaging startParam with YouTube Jsonp

    Unanswered: ListPaging startParam with YouTube Jsonp


    I use a list on my app to display content from my YouTube feed, I get the data using Jsonp and this is fine.
    I am trying to use the ListPaging plugin and I'm close to getting it to work.

    The issue is that by default the startParam is set to 0 and I need to start at 1 (and then go to 11, 21, etc., rather than 0, 10, 20, etc) - this is because YouTube uses a one-based index.

    The list starts empty (as the startParam being 0 is invalid, but then loads the content when scrolled as 10 is valid). I hope this is clear.

    My question: is there a way I can set the startParam (which is start-index for the YouTube Json) to 1 initially and then have it go up by 10 each time?

    Finally, here is the code for my store:

    Code:
    Ext.define('App.store.YouTubeStore', {    extend:'Ext.data.Store',
        config: {
            autoLoad: true,
            
            remoteFilter:false,
            sortOnFilter:false,
            clearOnPageLoad: false,  // This is true by default
            pageSize: 10,            // This needs to be set for paging
            
            fields: ["totalItems", "startIndex", "itemsPerPage", "title", "description", "id", "likeCount", "ratingCount", "viewCount", "commentCount", {
                name: 'thumbnail',
                mapping: 'thumbnail.hqDefault'
            },{
                name: 'link',
                mapping: 'player.default'
            }],
            proxy:
            {
                type: 'jsonp',
                url: 'http://gdata.youtube.com/feeds/api/users/<USER>/uploads?alt=jsonc&v=2',
                
                           startParam: 'start-index',
                           limitParam: 'max-results',
                
                reader:
                {
                    type: 'json',
                    encodeRequest: true,
                    rootProperty: 'data.items'
                }
            }
        },
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,619
    Vote Rating
    434
    Answers
    3102
    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


    You can listen to the beforeload and set the start on the operation using the setStart and getStart methods.
    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