Class: DataGrid::Column
- Inherits:
-
Object
- Object
- DataGrid::Column
- Defined in:
- lib/data_grid/column.rb
Instance Attribute Summary collapse
-
#auto_filter_hash ⇒ Object
Returns the value of attribute auto_filter_hash.
-
#css_class ⇒ Object
Returns the value of attribute css_class.
-
#field ⇒ Object
Returns the value of attribute field.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#filter_by ⇒ Object
Returns the value of attribute filter_by.
-
#filter_data ⇒ Object
Returns the value of attribute filter_data.
-
#filter_value ⇒ Object
Returns the value of attribute filter_value.
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#global_summary ⇒ Object
Returns the value of attribute global_summary.
-
#hide_in_export ⇒ Object
Returns the value of attribute hide_in_export.
-
#sort_by ⇒ Object
Returns the value of attribute sort_by.
-
#sortable ⇒ Object
Returns the value of attribute sortable.
-
#style ⇒ Object
Returns the value of attribute style.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#summary_formatter ⇒ Object
Returns the value of attribute summary_formatter.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #filter_active? ⇒ Boolean
-
#initialize(column_field, attrs = {}) ⇒ Column
constructor
A new instance of Column.
- #sort_field ⇒ Object
Constructor Details
#initialize(column_field, attrs = {}) ⇒ Column
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/data_grid/column.rb', line 8 def initialize(column_field, attrs = {}) self.sortable = attrs[:sortable] || DataGrid.column_sortable self.title = attrs[:title] self.field = column_field self.sort_by = attrs[:sort_by] || self.field self.filter = attrs[:filter] self.filter_data = [] self.style = attrs[:style] self.summary = attrs[:summary] self.global_summary = attrs[:global_summary] self.summary_formatter = attrs[:summary_formatter] || DataGrid.column_summary_formatter self.formatter = attrs[:formatter] self.filter_by = attrs[:filter_by] || self.field self.hide_in_export = attrs[:hide_in_export] || false self.css_class = attrs[:css_class] || '' self.auto_filter_hash = attrs[:auto_filter_hash] end |
Instance Attribute Details
#auto_filter_hash ⇒ Object
Returns the value of attribute auto_filter_hash.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def auto_filter_hash @auto_filter_hash end |
#css_class ⇒ Object
Returns the value of attribute css_class.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def css_class @css_class end |
#field ⇒ Object
Returns the value of attribute field.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def field @field end |
#filter ⇒ Object
Returns the value of attribute filter.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def filter @filter end |
#filter_by ⇒ Object
Returns the value of attribute filter_by.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def filter_by @filter_by end |
#filter_data ⇒ Object
Returns the value of attribute filter_data.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def filter_data @filter_data end |
#filter_value ⇒ Object
Returns the value of attribute filter_value.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def filter_value @filter_value end |
#formatter ⇒ Object
Returns the value of attribute formatter.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def formatter @formatter end |
#global_summary ⇒ Object
Returns the value of attribute global_summary.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def global_summary @global_summary end |
#hide_in_export ⇒ Object
Returns the value of attribute hide_in_export.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def hide_in_export @hide_in_export end |
#sort_by ⇒ Object
Returns the value of attribute sort_by.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def sort_by @sort_by end |
#sortable ⇒ Object
Returns the value of attribute sortable.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def sortable @sortable end |
#style ⇒ Object
Returns the value of attribute style.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def style @style end |
#summary ⇒ Object
Returns the value of attribute summary.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def summary @summary end |
#summary_formatter ⇒ Object
Returns the value of attribute summary_formatter.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def summary_formatter @summary_formatter end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/data_grid/column.rb', line 6 def title @title end |
Instance Method Details
#filter_active? ⇒ Boolean
34 35 36 |
# File 'lib/data_grid/column.rb', line 34 def filter_active? !self.filter_value.to_s.split(DataGrid.range_separator).first.blank? end |
#sort_field ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/data_grid/column.rb', line 26 def sort_field if self.field.class == Symbol return self.sort_by ? self.sort_by : self.field else return self.sort_by end end |