In most use cases it is recommended to use View Decorators to render custom data to provide reusable and composable view fragments without polluting component definitions with custom logic.
However, if you need a simple one-off data transformation when using a Table, you can specify a Proc
within the table fields
definition by using the secondary form of passing an Array
of [Symbol, Hash]
instead of just a Symbol
for any given field.
The Proc
will receive the current record (i.e. the object for the current row of a collection
with a Collection Table or the item
with an Item Table).
Name | |
---|---|
john@example.com | JOHN SMITH |
sally@example.org | SALLY ANDERSON |