Skip to content

Instantly share code, notes, and snippets.

View brendanhay's full-sized avatar
💭
💩

Brendan Hay brendanhay

💭
💩
View GitHub Profile
@brendanhay
brendanhay / paginated_collection.js
Created February 11, 2012 16:23 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {