Module: Datagrid::Ordering::InstanceMethods

Defined in:
lib/datagrid/ordering.rb

Overview

ClassMethods

Instance Method Summary collapse

Instance Method Details

#assetsObject

:nodoc:


41
42
43
44
# File 'lib/datagrid/ordering.rb', line 41

def assets # :nodoc:
  check_order_valid!
  apply_order(super)
end

#order_columnObject

Returns a column definition that is currently used to order assets

class MyGrid
  scope { Model }
  column(:id)
  column(:name)
end
MyGrid.new(:order => "name").order_column # => #<Column name: "name", ...>

55
56
57
# File 'lib/datagrid/ordering.rb', line 55

def order_column
  order && column_by_name(order)
end

#ordered_by?(column) ⇒ Boolean

Returns true if given grid is ordered by given column. column can be given as name or as column object

Returns:

  • (Boolean)

61
62
63
# File 'lib/datagrid/ordering.rb', line 61

def ordered_by?(column)
  order_column == column_by_name(column)
end