Sha256: 3bb98c8c2883f4db5ac60c55f529159c3f927bd1ee45559bae43de7d486c9d3c

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 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[: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

3 entries across 3 versions & 1 rubygems

Version Path
ajax-datatables-rails-0.4.3 lib/ajax-datatables-rails/datatable/column/order.rb
ajax-datatables-rails-0.4.2 lib/ajax-datatables-rails/datatable/column/order.rb
ajax-datatables-rails-0.4.1 lib/ajax-datatables-rails/datatable/column/order.rb