When to Use

When you have more data than your grid can fit, you can use Paginator to break the display of your data into pages.


Backgrid.Extension.Paginator needs a Backbone.Collection subclass that supports pagination. Luckily, there is already one available specially written for this purpose - Backbone.PageableCollection.

Backbone.PageableCollection is a strict superset of the vanilla Backbone.Collection with additional pagination and sorting functionality. If you like, you can use Backbone.PageableCollection throughout your application and it will work exactly the same as Backbone.Collection.


Out of the box, Backbone.PageableCollection works with RESTful APIs that accept Ruby's will_paginate pagination query parameters but you are able to configure the query string mapping anyway you like. The following example works with Github's API:

Configuring Backgrid.Extension.Paginator

Backgrid.Extension.Paginator supports a number of configuration options to adjust to the size of the result set. You can control the default window size, how many pages to slide an whether the grid should go back to the first page after sorting.


Advanced Usage

You can control how the control and page handles are rendered, you can even control how the sliding window algorithm works. Please refer to the JSDoc for details.