大佬教程收集整理的这篇文章主要介绍了如何使用复选框显示/隐藏下拉 Ransack 过滤器?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我创建了这些 Ransack 下拉过滤器。我现在应该使用带有复选框的第二个“添加过滤器”下拉菜单来显示/隐藏每个过滤器。
The IDea is that,for example,when the subscription_payment_type_eq
checkBox is SELEcted,the corresponding filter (with the same Name) is shown,and hIDden when the checkBox is unSELEcted.
<%= search_form_for @search,url: admin_users_path,HTML: {Class: "form-inline"} do |f| %>
<div class="form-group hIDden">
<%= f.SELEct :subscription_payment_type_eq,payment_types_SELEctor_for_filter,{ include_blank: "Payment type..."},class: "form-control gray" %>
</div>
<div class="form-group hIDden">
<%= f.SELEct :address_province_eq,user_provinces_SELEctor_for_filter,{ include_blank: "province..."},class: "form-control gray" %>
</div>
<div class="form-group hIDden">
<%= f.SELEct :subscription_status_eq,subscription_status_SELEctor_for_filter,{ include_blank: "Subscription status..."},class: "form-control gray" %>
</div>
<%= f.submit "Filter",class: "btn btn-priMary" %>
<%= link_to "Remove filters",admin_users_path,class: 'btn btn-default' %>
<% end %>
我们在@R_291_9616@中使用 Stimulus.Js 控制器和基本的隐藏/显示功能。
我尝试使用复选框标签和标签,但我什至不确定如何将复选框绑定到某个 f.SELEct
过滤器以开始摆弄 Stimulus 控制器。
<div class="btn-group">
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Add filter <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li class="m-1">
<label>
<%= check_Box_tag 'subscription_payment_type_eq' %>
Payment type
</label>
</li>
<li class="m-1">
<%= label_tag do %>
<%= check_Box_tag 'address_province_eq' %>
province
<% end %>
</li>
<li class="m-1">
<%= check_Box_tag 'subscription_status_eq' %>
<label>Subscription status</label>
</li>
</ul>
</div>
任何帮助将不胜感激。
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的如何使用复选框显示/隐藏下拉 Ransack 过滤器?全部内容,希望文章能够帮你解决如何使用复选框显示/隐藏下拉 Ransack 过滤器?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。