Skip to content

Instantly share code, notes, and snippets.

@hai5nguy
Created December 11, 2015 15:56
Show Gist options
  • Save hai5nguy/3a493cef5bf25e050ad4 to your computer and use it in GitHub Desktop.
Save hai5nguy/3a493cef5bf25e050ad4 to your computer and use it in GitHub Desktop.
(function fetchPage(page) {
self.collection.paging.page = page;
self.collection.fetch({
success: function (collection) {
models = models.concat(collection.models);
combineAttributesFrom(collection);
updateTemplate.call(self);
if (collection.models.length === self.collection.paging.pageSize) {
fetchPage(++page); //get more
}
}
});
})(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment