Closed mrudult closed 3 years ago
See the migration doc : https://github.com/jbox-web/ajax-datatables-rails/blob/master/doc/migrate.md
@n-rodriguez I did follow the migration guide. I'm still getting the same issue. Also, according to the docs, the following should work:
# after
respond_to do |format|
format.json { render json: BrandDatatable.new(params, view_context: view_context) }
end
But I get - NoMethodError (undefined method 'fetch' for nil:NilClass):
However, if I do:
respond_to do |format|
format.json { render json: BrandDatatable.new(params: params, view_context: view_context) }
end
Then it works (without the search and ordering)
BTW this is wrong :
def view_columns
@view_columns ||= {
display_name: {source: "Brand.display_name", cond: :like, searchable: true},
active: "Brand.active",
brand_reference_no: "Brand.brand_reference_no",
created_at: "Brand.created_at"
}
end
See : https://github.com/jbox-web/ajax-datatables-rails#a-declare-columns-mapping
@n-rodriguez Tried that too, but to no avail.
This is my datatable class:
This is request being sent to the controller from the frontend:
As we can see, no search queries is getting generated or build by
get_raw_records
. Any help will be highly appreciated!We are trying to upgrade our app from Rails 4.x to 5.x and
ajax-datatable-rails
from 0.3 to 1.2. Everything was working fine in 0.3