ActiveAdmin add filter to form

前端 未结 1 1565
心在旅途
心在旅途 2020-12-22 08:03

I have some properties on an active admin model, which can have a LOT of different values, so right now I\'m displaying them using checkboxes:

  PropertyType         


        
相关标签:
1条回答
  • 2020-12-22 08:17

    Yes. Check out chosen_rails gem.

    In active_admin it will look something like this:

    f.input :property_values,
      label: pt.display_name,
      as: :check_boxes,
      collection: pt.property_values.order(name: :asc, display_name: :asc).load,
      input_html: { class: 'chosen-select' },
      multiple: true
    

    The only thing I haven't tried it with check_boxes, but with as: :select, and it works perfectly. I think select would be doing the same for you, since you have multiple: true

    0 讨论(0)
提交回复
热议问题