Module: Cheveret::Table::Sorting::ClassMethods

Defined in:
lib/cheveret/table/sorting.rb

Instance Method Summary collapse

Instance Method Details

#default_sort(column_name, direction) ⇒ Object

TODO: depricate



54
55
56
57
58
59
# File 'lib/cheveret/table/sorting.rb', line 54

def default_sort(column_name, direction)
  raise ArgumentError 'Column not found' unless columns.has_key?(column_name)

  @default_sort_column    = columns[column_name]
  @default_sort_direction = direction
end

#sortable_on(*args) ⇒ Object

defines which table columns can be sorted by the user



44
45
46
47
48
49
# File 'lib/cheveret/table/sorting.rb', line 44

def sortable_on(*args)
  args.each do |column_name|
    raise "unrecognised column #{column_name}" unless columns[column_name]
    columns[column_name].sortable = true
  end
end