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'
}
}
},
});