Results 1 to 2 of 2

Thread: ListPaging startParam with YouTube Jsonp

  1. #1
    Sencha User kenono's Avatar
    Join Date
    Jun 2012
    Location
    Liverpool, UK
    Posts
    13
    Answers
    1
    Vote Rating
    1
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    You can listen to the beforeload and set the start on the operation using the setStart and getStart methods.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

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