Class: ProMotion::DataTableScreen
- Inherits:
-
TableScreen
- Object
- TableViewController
- TableScreen
- ProMotion::DataTableScreen
- Defined in:
- lib/project/pro_motion/data_table_screen.rb
Overview
TODO ? - set_attributes is called twice - seems like this is in PM core this is because we call setup when we build the cell and setup when its about to display - this is because PM wants styling to fire in each case - and properties was where the styling is done in PM
if we are going to wire an event when a value is set on a cell, this could be problematic, especially likely since cells are reused, etc see my new cell for example, where I have to remove and then add events because of the double call
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from TableScreen
Class Method Details
.cell(cell) ⇒ Object
13 14 15 |
# File 'lib/project/pro_motion/data_table_screen.rb', line 13 def self.cell(cell) @cell = cell end |
.cell_properties ⇒ Object
17 18 19 |
# File 'lib/project/pro_motion/data_table_screen.rb', line 17 def self.cell_properties @cell end |
Instance Method Details
#cell_data ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/project/pro_motion/data_table_screen.rb', line 31 def cell_data return [] if cell_properties.nil? return [] if data_model.nil? data_model.send(data_scope).collect do |c| { cell_class: cell_class, properties: properties.inject({}) do |hash, element| hash[element.first] = c.send(element.last) hash end } end end |
#cell_properties ⇒ Object
27 28 29 |
# File 'lib/project/pro_motion/data_table_screen.rb', line 27 def cell_properties self.class.cell_properties end |
#table_data ⇒ Object
21 22 23 24 25 |
# File 'lib/project/pro_motion/data_table_screen.rb', line 21 def table_data [{ cells: cell_data }] end |