Skip to content

Adding a provider

Mark Headd edited this page Jan 28, 2016 · 7 revisions

Provider requirements

  • initialize should call its BaseProvider's method via BaseProvider.prototype.initialize.apply(this, arguments)
  • To use a custom [fields collection](fields collections), create a class that extends basefields.js and set the fieldsCollection property to it in the provider
  • url should handle URL construction based on the state of the collection (current filters, sorting, etc.)
  • exportUrl should return the downloadable (CSV) version of the url
  • getRecordCount should return a deferredpromise that passes the total number of records that exist when resolved
  • getFields should return a promise that passes a collection (of instance BaseFields) 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.


  1. Add your provider to providers.js
  2. Specify its use using the provider option in a card's config object