Method: DataTable::Table#render_rows

Defined in:
lib/data-table/table.rb

#render_rows(collection) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/data-table/table.rb', line 118

def render_rows(collection)
  html = ''
  collection.each_with_index do |row, row_index|
    css_class = @alternate_rows && row_index.odd? ? 'alt ' : ''
    if @row_style && style = @row_style.call(row, row_index)
      css_class << style
    end

    attributes = @row_attributes.nil? ? {} : @row_attributes.call(row)
    html << render_row(row, row_index, css_class, attributes)
  end
  html
end