简体   繁体   English

如果用户选择日期时间作为搜索条件,则ActiveAdmin中的Meat_search无法正常工作

[英]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 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 通常在工作状态下查询形式如下: 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 但是在当前情况下,查询的格式为: 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) 我正在使用的版本: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. 如果我通过编辑其html源手动设置日期,它将开始工作,但一旦重置,它将无法工作。

Issue has been found with jQuery 1.9 compatibility issue 已发现jQuery 1.9兼容性问题

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: 我们需要编辑以下文件: app / assets / javascripts / active_admin / pages / application.js.coffee和#过滤表单:不要发送任何为空的输入,请替换为:

$(@).find(':input[value=""]').attr 'disabled', 'disabled' with $(@).find(':input').filter(-> @value is '').prop 'disabled', true $(@).find(':input[value=""]').attr 'disabled', 'disabled' $(@).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. 您还可以通过添加以下行来更改gem.lock文件以加载此修订: remote: https://github.com/gregbell/active_admin.git revision: 606b88afa99ac6255a07bf68f55336e302327083它对我remote: https://github.com/gregbell/active_admin.git revision: 606b88afa99ac6255a07bf68f55336e302327083

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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