Closed jdaprato closed 5 years ago
filter
options are not automatically passed to a <select>
tag. However you can build custom options if you want. Doc: https://github.com/bogdan/datagrid/wiki/Frontend#filter-input-html-options
Thanks a lot for your answer.
If it can help here exactly the changes I've made:
in _form.html.erb:
<%= f.datagrid_filter filter, filter.options[:input_options] %>
In my devices_grid.rb:
filter(:age_range_id, :enum, :select => proc {AgeRange.all.map {|a| [a.name, a.id]}}, :multiple => true, input_options: {title: "Aucune sélection", class: 'form-control selectpicker'})
It works like a charm ! Have a nice day !
Hello Bogdan,
First of all thanks a lot for your tremendous work very userful and documented ! That being said, I've been trying to integrate bootstrap select (https://developer.snapappointments.com/bootstrap-select/) with your filter system and it worked fine until I tried to add the title attribute. Unfortunately it seems that this attribute is not taken into account, nothing happens. Here's the code:
filter(:age_range_id, :enum, :select => proc {AgeRange.all.map {|a| [a.name, a.id]}}, :class => 'form-control selectpicker', :title => "Aucune sélection")
And here's the current render :![image](https://user-images.githubusercontent.com/31930817/58634764-6d59b880-82ec-11e9-828f-21638828a364.png)
Any help would be appreciated,