简体   繁体   中英

Meat_search in ActiveAdmin is not working in case user selects datetime as search criteria

When you access your admin page, search filter used to return the results as expected for dates selected. filter :hash_key filter :serial_number filter :partner filter :created_at

I have made changes to tables like added few more columns. Now all the search filter works fine except filter:

created_at

When date is selected, it reflects on the page but the same value is not passed to server. Usually in working condition query will form like: http://.../admin/entitlements?utf8=%E2%9C%93&q%5Bcreated_at_gte%5D=2016-02-10&commit=Filter&order=id_desc

But in current case, query is formed as: http://.../admin/entitlements?utf8=%E2%9C%93&q%5Bhash_key_contains%5D=&q%5Bserial_number_contains%5D=&q%5Bpartner_id_eq%5D=&commit=Filter&order=id_desc

It will not have date entry here.

Version i am using: activeadmin (0.5.1) meta_search (1.1.3)

If i set the date manually by edit its html source, it starts working but upon reset, it will not work.

Issue has been found with jQuery 1.9 compatibility issue

we need to edit the following file: app/assets/javascripts/active_admin/pages/application.js.coffee and # Filter form: don't send any inputs that are empty replace this:

$(@).find(':input[value=""]').attr 'disabled', 'disabled' with $(@).find(':input').filter(-> @value is '').prop 'disabled', true

You can also change the gem.lock file to load this revision by adding the following line: remote: https://github.com/gregbell/active_admin.git revision: 606b88afa99ac6255a07bf68f55336e302327083 It has worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM