Sha256: 4713a1df5c15dcd7166f3de191596ef2a3ca4eec420688bc6229446f6dd81e2c

Contents?: true

Size: 609 Bytes

Versions: 7

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

module AjaxDatatablesRails
  module Datatable
    class Column
      module Order

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

        # Add sort_field option to allow overriding of sort field
        def sort_field
          @view_column.fetch(:sort_field, field)
        end

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

        # Add option to sort null values last
        def nulls_last?
          @view_column.fetch(:nulls_last, false)
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ajax-datatables-rails-1.5.0 lib/ajax-datatables-rails/datatable/column/order.rb
ajax-datatables-rails-1.4.0 lib/ajax-datatables-rails/datatable/column/order.rb
ajax-datatables-rails-1.3.1 lib/ajax-datatables-rails/datatable/column/order.rb
ajax-datatables-rails-1.3.0 lib/ajax-datatables-rails/datatable/column/order.rb
ajax-datatables-rails-1.2.0 lib/ajax-datatables-rails/datatable/column/order.rb
ajax-datatables-rails-1.1.0 lib/ajax-datatables-rails/datatable/column/order.rb
ajax-datatables-rails-1.0.0 lib/ajax-datatables-rails/datatable/column/order.rb