class TableSettings::Column

Attributes

index[RW]

Public Class Methods

new(table_settings, index) click to toggle source
# File lib/table_settings/table_column.rb, line 8
def initialize(table_settings, index)
  @table_settings = table_settings
  @column_hash = {}
  @index = index
end

Public Instance Methods

column_hash() click to toggle source
# File lib/table_settings/table_column.rb, line 14
def column_hash
  @column_hash
end
css_class(class_name) click to toggle source
# File lib/table_settings/table_column.rb, line 18
def css_class(class_name)
  @column_hash[:class] = class_name

  self
end
css_header_class(class_name) click to toggle source
# File lib/table_settings/table_column.rb, line 23
def css_header_class(class_name)
  @column_hash[:header_class] = class_name

  self
end
csv_excluded(bool = true) click to toggle source

Set if column is excluded from csv export

# File lib/table_settings/table_column.rb, line 133
def csv_excluded(bool = true)
  @column_hash[:csv_excluded] = bool
  self
end
editable(bool = true) click to toggle source

For editable table, defines wchich column should be editable

# File lib/table_settings/table_column.rb, line 121
def editable(bool = true)
  @column_hash[:editable] = bool
  self
end
filter_data(array) click to toggle source
# File lib/table_settings/table_column.rb, line 47
def filter_data(array)
  @column_hash[:filter_data] = array

  self
end
filter_type(filter_type) click to toggle source
# File lib/table_settings/table_column.rb, line 29
def filter_type(filter_type)
  if filter_type == :none
    @column_hash.delete(:filter)
  else
    @column_hash[:filter] = filter_type
  end

  self
end
format_method(method_name) click to toggle source
# File lib/table_settings/table_column.rb, line 59
def format_method(method_name)
  @column_hash[:format_method] = method_name

  self
end
global_format_method(method_name) click to toggle source

Sets global format method used for values

# File lib/table_settings/table_column.rb, line 66
def global_format_method(method_name)
  @column_hash[:global_format_method] = method_name

  self
end
inactive_filter(bool = true) click to toggle source

When using the filter box in header but filters in own way, not by table (just passing already filtered AREL to table)

# File lib/table_settings/table_column.rb, line 127
def inactive_filter(bool = true)
  @column_hash[:inactive_filter] = bool
  self
end
max_text_length(length) click to toggle source
# File lib/table_settings/table_column.rb, line 53
def max_text_length(length)
  @column_hash[:max_text_length] = length

  self
end
non_breakable(bool = true) click to toggle source

Defines column with non-breakable content (for example column with more buttons)

@param [Boolean] bool

# File lib/table_settings/table_column.rb, line 107
def non_breakable(bool = true)
  @column_hash[:non_breakable] = bool
  self
end
non_sortable(bool = true) click to toggle source

Defines column with non-sortable content. Affects only standard columns. Sortable if not set.

@param [Boolean] bool

# File lib/table_settings/table_column.rb, line 116
def non_sortable(bool = true)
  @column_hash[:non_sortable] = bool
end
sql_expression(expression) click to toggle source

Defines select expression for column (ie. select count(id) as counter)

# File lib/table_settings/table_column.rb, line 42
def sql_expression(expression)
  @column_hash[:sql_expression] = expression
  self
end
summarize_all(enabled = true, label = nil) click to toggle source

Sets if column has summarization cell per table Standard column will be computed Custom column have to set TableSettings::Buttons.summarize_all_value in callback method

@param [Boolean] enabled - has/has not this cell @param [String|nil] label in this cell (for example “Summary”)

# File lib/table_settings/table_column.rb, line 97
def summarize_all(enabled = true, label = nil)
  @column_hash[:summarize_all] = true
  @column_hash[:summarize_all_label] = label unless label.nil?
  self
end
summarize_page(enabled = true, label = nil) click to toggle source

Sets if column has summarization cell per page Standard column will be computed Custom column have to set TableSettings::Buttons.summarize_page_value in callback method

@param [Boolean] enabled - has/has not this cell @param [String|nil] label in this cell (for example “Summary”)

# File lib/table_settings/table_column.rb, line 84
def summarize_page(enabled = true, label = nil)
  @column_hash[:summarize_page] = true
  @column_hash[:summarize_page_label] = label unless label.nil?
  self
end
title(string) click to toggle source

Help Title (for mouseover) of column, no title means usage of value

# File lib/table_settings/table_column.rb, line 73
def title(string)
  @column_hash[:title] = string
end