Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Pagination in Backbone.js
- var Paginated = Backbone.Collection.extend({
- pagination : function(perPage, page) {
- page = page-1;
- var collection = this;
- collection = _(collection.rest(perPage*page));
- collection = _(collection.first(perPage));
- return collection.map( function(model) { return model.toJSON() } );
- }
- });
Add Comment
Please, Sign In to add comment