class TableSettings::Column
Attributes
Public Class Methods
# 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
# File lib/table_settings/table_column.rb, line 14 def column_hash @column_hash end
# File lib/table_settings/table_column.rb, line 18 def css_class(class_name) @column_hash[:class] = class_name self end
# File lib/table_settings/table_column.rb, line 23 def css_header_class(class_name) @column_hash[:header_class] = class_name self end
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
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
# File lib/table_settings/table_column.rb, line 47 def filter_data(array) @column_hash[:filter_data] = array self end
# 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
# File lib/table_settings/table_column.rb, line 59 def format_method(method_name) @column_hash[:format_method] = method_name self end
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
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
# File lib/table_settings/table_column.rb, line 53 def max_text_length(length) @column_hash[:max_text_length] = length self end
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
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
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
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
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
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