-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow again overriding filter_records, sort_records... #228
Comments
I ran into the same issue. 👍 Thanks for the workaround. |
Thanks for posting this. I just ran into the exact same issue. |
@panmari thanks, same issue and now solved. |
@panmari oh this make search column on associated model not working correctly, 2 records of associated model with different content always retrieves and displayed. If I am not override this way, it can search column and filter nested content correctly. |
One thing to note about @panmari's workaround is that it doesn't affect the class ExampleDatatable < AjaxDatatablesRails::Base
private
def load_orm_extension
super
extend CustomOverrides
end
module CustomOverrides
def filter_records(records)
records = super(records)
records.where(:other => "stuff")
end
end
end |
An other way to fix this would be to make the gem a Rails engine. This way we could hook on Rails to extend the |
But you loose the ability of having datatables plugged on Mongoid models. |
But Mongoid models are not really supported. There is no implementation for this adapter. So what do we do? What do you suggest? What do you prefer? |
See #288 (comment) and https://github.com/jbox-web/ajax-datatables-rails/tree/feat/ar_class |
Hi there! It's now fixed : 719d623 |
Currently, when overriding for example
filter_records
in a custom datatable, it's ignored due to 'load_orm_extension' being called on initialize, which overrides the custom method by the one provided in the orm.According to the rails generator datatable template, such use should be possible:
As a workaround I'm currently overriding
retrieve_records
in my custom datatableThe text was updated successfully, but these errors were encountered: