Module: Datagrid::Ordering
- Included in:
- Base
- Defined in:
- lib/datagrid/ordering.rb
Overview
Module adds support for ordering by defined columns for Datagrid.
Instance Method Summary collapse
-
#descending=(value) ⇒ void
Specify an order direction for an order column.
-
#descending? ⇒ Boolean
Specified order direction.
-
#order ⇒ Symbol?
Specified order column name.
-
#order=(value) ⇒ void
Specify a column to be used to order the grid.
-
#order_column ⇒ Datagrid::Columns::Column?
A column definition that is currently used to order assets.
-
#ordered_by?(column, desc = nil) ⇒ Boolean
True if given grid is ordered by given column.
Instance Method Details
#descending=(value) ⇒ void
This method returns an undefined value.
Specify an order direction for an order column
|
# File 'lib/datagrid/ordering.rb', line 55
|
#descending? ⇒ Boolean
Returns specified order direction.
|
# File 'lib/datagrid/ordering.rb', line 61
|
#order ⇒ Symbol?
Returns specified order column name.
|
# File 'lib/datagrid/ordering.rb', line 51
|
#order=(value) ⇒ void
This method returns an undefined value.
Specify a column to be used to order the grid
|
# File 'lib/datagrid/ordering.rb', line 36
|
#order_column ⇒ Datagrid::Columns::Column?
Returns a column definition that is currently used to order assets.
79 80 81 |
# File 'lib/datagrid/ordering.rb', line 79 def order_column order ? column_by_name(order) : nil end |
#ordered_by?(column, desc = nil) ⇒ Boolean
Returns true if given grid is ordered by given column.
86 87 88 89 |
# File 'lib/datagrid/ordering.rb', line 86 def ordered_by?(column, desc = nil) order_column == column_by_name(column) && (desc.nil? || (desc ? descending? : !descending?)) end |