Class: Phlexi::Table::Components::DataColumn
- Defined in:
- lib/phlexi/table/components/data_column.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #data_cell(wrapped_object) ⇒ Object
- #header_cell ⇒ Object
-
#initialize(&block) ⇒ DataColumn
constructor
A new instance of DataColumn.
Methods included from Concerns::DisplaysData
Methods included from Concerns::DisplaysHeader
#colspan, #header_cell_attributes
Methods included from Options::Alignment
Methods included from Options::Labels
Methods inherited from Base
Constructor Details
#initialize(&block) ⇒ DataColumn
Returns a new instance of DataColumn.
7 8 9 10 |
# File 'lib/phlexi/table/components/data_column.rb', line 7 def initialize(*, **, &block) super(*, **) @block = block end |
Instance Method Details
#data_cell(wrapped_object) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/phlexi/table/components/data_column.rb', line 16 def data_cell(wrapped_object) if @block @block.call(wrapped_object, key) else field = wrapped_object.field(key) field.send(:"#{field.inferred_field_component}_tag") end end |
#header_cell ⇒ Object
12 13 14 |
# File 'lib/phlexi/table/components/data_column.rb', line 12 def header_cell SortableHeaderCell.new(label, sort_params:) end |