Sha256: 94b9c520d74ba277bddb0e264238e8afec2d60fbaeae3adfb42b0442ea80a115

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

module Effective
  module EffectiveDatatable
    module Hooks

      # Called on the final collection after searching, ordering, arrayizing and formatting have been completed
      def finalize(collection) # Override me if you like
        collection
      end

      # Override this function to perform custom searching on a column
      def search_column(collection, table_column, search_term, sql_column_or_index)
        if table_column[:array_column]
          array_tool.search_column_with_defaults(collection, table_column, search_term, sql_column_or_index)
        else
          table_tool.search_column_with_defaults(collection, table_column, search_term, sql_column_or_index)
        end
      end

      # Override this function to perform custom ordering on a column
      # direction will be :asc or :desc
      def order_column(collection, table_column, direction, sql_column_or_index)
        if table_column[:array_column]
          array_tool.order_column_with_defaults(collection, table_column, direction, sql_column_or_index)
        else
          table_tool.order_column_with_defaults(collection, table_column, direction, sql_column_or_index)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_datatables-2.12.2 app/models/effective/effective_datatable/hooks.rb
effective_datatables-2.12.1 app/models/effective/effective_datatable/hooks.rb
effective_datatables-2.12.0 app/models/effective/effective_datatable/hooks.rb
effective_datatables-2.11.2 app/models/effective/effective_datatable/hooks.rb
effective_datatables-2.11.1 app/models/effective/effective_datatable/hooks.rb
effective_datatables-2.11.0 app/models/effective/effective_datatable/hooks.rb
effective_datatables-2.10.0 app/models/effective/effective_datatable/hooks.rb