daily pastebin goal
95%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top