-
Notifications
You must be signed in to change notification settings - Fork 27
Formatters
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.
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.
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.