Module: AjaxDatatablesRails::Datatable::Column::Order

Included in:
AjaxDatatablesRails::Datatable::Column
Defined in:
lib/ajax-datatables-rails/datatable/column/order.rb

Instance Method Summary collapse

Instance Method Details

#nulls_last?Boolean

Add option to sort null values last

Returns:

  • (Boolean)


22
23
24
# File 'lib/ajax-datatables-rails/datatable/column/order.rb', line 22

def nulls_last?
  @view_column.fetch(:nulls_last, false)
end

#orderable?Boolean

Returns:

  • (Boolean)


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

def orderable?
  @view_column.fetch(:orderable, true)
end

#sort_fieldObject

Add sort_field option to allow overriding of sort field



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

def sort_field
  @view_column.fetch(:sort_field, field)
end

#sort_queryObject



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

def sort_query
  custom_field? ? source : "#{table.name}.#{sort_field}"
end