Skip to content
This repository was archived by the owner on Jan 2, 2019. It is now read-only.

Formatters

teleological edited this page Sep 6, 2011 · 2 revisions

Formatter factory

Slick.Grid assumes that the fields named in the columns descriptor are members of the "items" that it renders. This is not true in the case of a Backbone.Model, which stores its fields and field values in an attributes object, providing a get method as accessor. Slickback addresses this problem by providing the Slickback.BackboneModelFormatterFactory. When passed as the formatterFactory to a Slick.Grid constructor, the BackboneModelFormatterFactory generates column formatter methods that use a model's get method with the field value from a column descriptor.

Formatting numbers

Slickback.NumberFormatter provides support for displaying numerical values with a given decimal precision. By default, it displays values as integers. Optionally, it formats numbers with a thousands separator. Blank values may be left blank or displayed as zero.

Formatting enumerated data types

Columns which display values drawn from enumerated types may use Slickback.ChoiceFormatter to format the values for display, and handle the case where no value has been specified.

Clone this wiki locally