Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.
teleological edited this page Mar 4, 2012 · 5 revisions

Slickback.PaginatedCollection makes use of a number of mixin objects which handle the implementation of Pagination and the details of interoperability with SlickGrid, such as publishing and subscribing to Slickgrid Events. These mixins may have application independent of PaginatedCollection:

Slickback.CollectionAdaptorMixin

Adapts a Backbone.Collection to be used with Slick.Grid, which expects a collection to either be an array, or to implement getLength and getItem. Sample usage:

var prototypeConfig = _.extend({}, Slickback.CollectionAdaptorMixin);
var myCollection = Backbone.Collection.extend(prototypeConfig);

Slickback.PaginatedCollectionMixin

Adapts a Backbone.Collection to be used with a paginated data source. See Pagination for details on the supported conventions for passing and parsing pagination parameters. Includes the paginatedScope, fetchWithPagination, parseWithPagination, and addWithPagination methods. Also includes installPaginatedIngestors, which replaces an instance's implementation of parse and add with the paginated versions. Sample usage:

var prototypeConfig = _.extend({ initialize: function() { this.installPaginatedIngestors(); } },
                               Slickback.PaginatedCollectionMixin);
var myCollection = Backbone.Collection.extend(prototypeConfig);

Slickback.ScopedModelMixin

Adds an interface for composing parameters to be included in fetch requests. See Scopes for details. Includes the scope, extendScope, clearScope, fetchWithScope, fetchWithoutScope and scoped methods. Also includes installScopedModelDefaults, which may be used to apply a collection's default scope to all fetches. Sample usage:

var prototypeConfig = _.extend({ initialize: function() { this.installScopedModelDefaults(); } },
                               Slickback.ScopedModelMixin);
var myCollection = Backbone.Collection.extend(prototypeConfig);
Clone this wiki locally