I can't get this to work. Using it with backgrid, following your example code.
My PageableCollection.
Dummy parseLinks for testing.
var PageableActivityCollection = PageableCollection.extend(
{
model: ActivityModel,
mode: 'infinite',
state: {
pageSize: 20,
sortKey: 'created_at',
order: 1,
firstPage: 1,
currentPage: 1
},
initialize: function(options)
{
this.queryParams.link_id = options.link_id;
this.queryParams.link_type = options.link_type;
},
queryParams: {
totalPages: null,
pageSize: 'ps',
currentPage: 'page',
sortKey: "s",
order: "d",
directions: {
"-1": "asc",
"1": "desc"
}
},
url: '/data/activity',
parseLinks: function (resp, xhr)
{
return {
first: '/data/activity/1',
next: '/data/activity/2',
}
}
});
this.collection = new PageableActivityCollection(
{},
{
mode: 'infinite',
link_id: options.link_id,
link_type: options.link_type
});
this.collection.getFirstPage().complete(function ()
{
self.$el.find('.box-body .table-container').append(pageableGrid.render().$el);
self.$el.find('.box-body').append(footer.render().$el);
});
It fails on this line in getPage()
if (mode == "infinite") options.url = self.links[pageNum];
The issue is links has no value yet, no data has been retrieved from the server.
No matter what way I do this links is always undefined yet code references it, no fetch is ever performed.
What am I doing wrong?
I can't get this to work. Using it with backgrid, following your example code.
My PageableCollection.
Dummy parseLinks for testing.
It fails on this line in getPage()
The issue is links has no value yet, no data has been retrieved from the server.
No matter what way I do this links is always undefined yet code references it, no fetch is ever performed.
What am I doing wrong?