Module: AjaxDatatablesRails::Datatable::Column::Search

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

Constant Summary collapse

SMALLEST_PQ_INTEGER =
-2_147_483_648
LARGEST_PQ_INTEGER =
2_147_483_647
NOT_NULL_VALUE =
'!NULL'
EMPTY_VALUE =
''

Instance Method Summary collapse

Instance Method Details

#condObject



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

def cond
  @view_column.fetch(:cond, :like)
end

#filterObject



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

def filter
  @view_column[:cond].call(self, formatted_value)
end

#searchObject



25
26
27
# File 'lib/ajax-datatables-rails/datatable/column/search.rb', line 25

def search
  @search ||= SimpleSearch.new(options[:search])
end

#search_queryObject



33
34
35
# File 'lib/ajax-datatables-rails/datatable/column/search.rb', line 33

def search_query
  search.regexp? ? regex_search : non_regex_search
end

#searchable?Boolean

Returns:

  • (Boolean)


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

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

#searched?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/ajax-datatables-rails/datatable/column/search.rb', line 29

def searched?
  search.value.present?
end

#use_regex?Boolean

Add use_regex option to allow bypassing of regex search

Returns:

  • (Boolean)


38
39
40
# File 'lib/ajax-datatables-rails/datatable/column/search.rb', line 38

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