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 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,556
    Answers
    3931
    Vote Rating
    1272
      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! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

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
  •