Guest User

Untitled

a guest
Sep 14th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. Pagination in Backbone.js
  2. var Paginated = Backbone.Collection.extend({
  3.  
  4. pagination : function(perPage, page) {
  5. page = page-1;
  6. var collection = this;
  7. collection = _(collection.rest(perPage*page));
  8. collection = _(collection.first(perPage));
  9. return collection.map( function(model) { return model.toJSON() } );
  10. }
  11. });
Add Comment
Please, Sign In to add comment