-
Notifications
You must be signed in to change notification settings - Fork 38
Adding a provider
Mark Headd edited this page Jan 28, 2016
·
7 revisions
-
initializeshould call itsBaseProvider's method viaBaseProvider.prototype.initialize.apply(this, arguments) - To use a custom [fields collection](fields collections), create a class that extends
basefields.jsand set thefieldsCollectionproperty to it in the provider -
urlshould handle URL construction based on the state of the collection (current filters, sorting, etc.) -
exportUrlshould return the downloadable (CSV) version of theurl -
getRecordCountshould return adeferredpromise that passes the total number of records that exist when resolved -
getFieldsshould return a promise that passes a collection (of instanceBaseFields) when resolved
getFields should leverage this.fieldsCache, a hash of datasets and fields collections, to share fields collections between provider collections of the same dataset. To access the relevant fields collection, use this.fieldsCache[this.config.dataset].
Beyond that, you can use any other configuration options of Backbone Collections such as parse.
- Add your provider to
providers.js - Specify its use using the
provideroption in a card's config object