-
Notifications
You must be signed in to change notification settings - Fork 28
Mixins
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:
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);
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);
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);