-
Notifications
You must be signed in to change notification settings - Fork 64
Unable to get infinite mode working #34
Comments
Well I am a javascript retard. Of course I'm overriding initialize and not calling the super, and I got the wrong signature. Sigh... initialize: function(models,options)
{
this.queryParams.link_id = options.link_id;
this.queryParams.link_type = options.link_type;
PageableCollection.prototype.initialize.apply(this, options);
}, Will close shortly I expect :) |
Hmmm, now I'm stumped. Line 426 in _makeCollectionEventHandler: pageCol.pop() if (colToAdd) {
colToAdd.add(model, _extend({}, options || {}, {at: addAt}));
pageCol.pop();
}
} This ultimately results in a call to backgrid.Body.removeRow, which fails as there are no rows yet. I don't know what to do from here. I am creating an instance like this: this.collection = new PageableActivityCollection(
null,
{
mode: 'infinite',
link_id: options.link_id,
link_type: options.link_type
}); |
Mmm. I am not sure what's going on here, but fetching under infinite mode should not result in any Also, you might want to move your |
Wow, I spent hours on this today, insane waste of time. The issue is I create the Backgrid instance passing in the PageableCollection before I call getFirstPage(), and subsequently there is some flaw in the logic with regards to the collection being subsequently populated. If you change your example to create the grid outside of getFirstPage you'll hit the problem straight away. |
Seems like a bug inside the success handler. An https://github.com/wyuenho/backbone-pageable/blob/master/lib/backbone-pageable.js#L1078 |
Yup, I noticed that in my many step throughs, but the same thing was happening with your example on your github page and it worked fine. Only diff between yours and mine is when I instantiate backgrid. Thanks for the follow up. Great code, well designed. |
Cool thanks for being so responsive. I will do a fork for better handling paging for when there is no return data or less than expected. The current page is changed even if the amount of returned rows would result in the pageSize of the current page not being exceeded, resulting in an empty grid being displayed. |
👍 |
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?
The text was updated successfully, but these errors were encountered: