lib/ProMotion/table/table.rb in ProMotion-2.4.2 vs lib/ProMotion/table/table.rb in ProMotion-2.5.0.beta1
- old
+ new
@@ -21,10 +21,14 @@
set_up_refreshable
set_up_longpressable
set_up_row_height
end
+ def on_live_reload
+ update_table_data
+ end
+
def check_table_data
mp("Missing #table_data method in TableScreen #{self.class.to_s}.", force_color: :red) unless self.respond_to?(:table_data)
end
def promotion_table_data
@@ -285,17 +289,24 @@
# Section view methods
def tableView(_, viewForHeaderInSection: index)
section = promotion_table_data.section(index)
view = section[:title_view]
view = section[:title_view].new if section[:title_view].respond_to?(:new)
+ view.on_load if view.respond_to?(:on_load)
view.title = section[:title] if view.respond_to?(:title=)
view
end
def tableView(_, heightForHeaderInSection: index)
section = promotion_table_data.section(index)
if section[:title_view] || section[:title].to_s.length > 0
- section[:title_view_height] || tableView.sectionHeaderHeight
+ if section[:title_view_height]
+ section[:title_view_height]
+ elsif (section_header = tableView(_, viewForHeaderInSection: index)) && section_header.respond_to?(:height)
+ section_header.height
+ else
+ tableView.sectionHeaderHeight
+ end
else
0.0
end
end