-
Notifications
You must be signed in to change notification settings - Fork 38
Fields collections
Fields collections are basic Backbone Collections that contain information about each field/column in a dataset. They exist primarily to store readable field titles (ie. Violation Type instead of violation_type), which are used:
(a) in the table view for column headers, and
(b) beneath each card when listing its current filters
When adding a provider, you can create a fields collection for it to implement a provider-specific way to fetch and parse field information.
The class should extend BaseFields. At the time of this writing, BaseFields is a stub. But doing so will allow easier changes in the future.
The fields/items in the collection should have the following attributes:
-
datapointing to the field name in the dataset (ie.violation_type) -
titlepointing to the readable version of the field name (ie.Violation Type) -
typewith one of datatables' types (for table sorting) -
defaultContentwith a default value or an empty string ('') - Optional:
descriptionpointing to a description of the field
Beyond that, you can implement any other functionality Backbone Collections provide.
Note: The above API is a direct implementation of datatables columns, and should probably be abstracted. If you're interested in helping with this, post an issue about it!

