Class: EasyDataTables::Column

Inherits:
Object
  • Object
show all
Defined in:
app/models/easy_data_tables/column.rb

Overview

Column class, we can access the formated data and the data of a particular cell

Direct Known Subclasses

CombinedColumn, CustomColumn

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Column

values = {}, label = ”, type = ‘Integer’)



9
10
11
12
13
14
15
16
17
18
# File 'app/models/easy_data_tables/column.rb', line 9

def initialize(args = {})
  @label = args[:label] || ''
  @type = args[:type] || 'Integer'
  @default = args[:default] || 0
  @collection = args[:collection]
  @grouping = args[:grouping]
  @agregate_function = args[:agregate_function]
  @date_format = args[:date_format] || :default
  @values = construct_values
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



6
7
8
# File 'app/models/easy_data_tables/column.rb', line 6

def label
  @label
end

Instance Method Details

#data_at(row) ⇒ Object



24
25
26
# File 'app/models/easy_data_tables/column.rb', line 24

def data_at(row)
  @values[row]
end

#formated_data_at(row) ⇒ Object



20
21
22
# File 'app/models/easy_data_tables/column.rb', line 20

def formated_data_at(row)
  send(@type.downcase, row)
end