jbox-web/ajax-datatables-rails

Possibility to change operator from AND to OR

Closed this issue · 2 comments

I have got a table where the filters need be joined by OR instead of AND

Is there a way we can change this to accept :or?

Is there a way we can change this to accept :or?

Yes, just override the existing method :

class MyDatatable < AjaxDatatablesRails::ActiveRecord
 def build_conditions_for_selected_columns
   search_columns.map(&:search_query).compact.reduce(:or)
 end
end

@n-rodriguez Thanks. It worked.