Class: AjaxDatatablesRails::Datatable::SimpleOrder

Inherits:
Object
  • Object
show all
Defined in:
lib/ajax-datatables-rails/datatable/simple_order.rb

Constant Summary collapse

DIRECTIONS =
%w(DESC ASC)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(datatable, options) ⇒ SimpleOrder

Returns a new instance of SimpleOrder.



8
9
10
11
# File 'lib/ajax-datatables-rails/datatable/simple_order.rb', line 8

def initialize(datatable, options)
  @datatable = datatable
  @options = options || {}
end

Instance Attribute Details

#datatableObject (readonly)

Returns the value of attribute datatable.



4
5
6
# File 'lib/ajax-datatables-rails/datatable/simple_order.rb', line 4

def datatable
  @datatable
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/ajax-datatables-rails/datatable/simple_order.rb', line 4

def options
  @options
end

Instance Method Details

#columnObject



17
18
19
# File 'lib/ajax-datatables-rails/datatable/simple_order.rb', line 17

def column
  datatable.column_by(:index, column_index)
end

#query(sort_column) ⇒ Object



13
14
15
# File 'lib/ajax-datatables-rails/datatable/simple_order.rb', line 13

def query sort_column
  "#{ sort_column } #{ dir }"
end