https://avo.cool logo
Multi-Select filters (dynamic and standard) I ...
# resources
w
Multi-Select filters (dynamic and standard) I want to add filters for my users index view. I can single-select filter by e.g.
role
, that works fine. Now I want to extend this to multi select: 1. With the Standard filters, I can manually select multiple entries by CMD+click. However, only ~4 entries are shown, but my list is a lot longer - the filter is missing a scrollbar! And besides that, the UX could be improved to something like the tags-field (I know, multi selects are really hard, been there, done that...) 2. I tried out dynamic filters, but could only filter for one role, not for multiple. Any chances or plans to add this? Could be a good reason for upgrading my subscription 😉
m
Thread automatically created by Tim in #1141725701549072486
l
Thanks for flaging this @wide-waiter-22763 I just released
avo 4.0.13
that has the scrollbar on the multiple select! About the dynamic filters, what database type is the
role
column?
w
Nice, thanks for the fix! The role column is a simple string (with enumerize, so there are only limited options available). So in this case we do not need to match two arrays against each other, in ransack terms it's the
_in
predicate 🙂
l
We have intentions to add a multiple select `dynamic filter at some point, for now you can achive you'r use-case with something like this:
Copy code
ruby
field :role,
  as: :select,
  filterable: {
    type: :tags,
    conditions: {},
    suggestions: User.role.values, # or your enumerize list
    query: -> {
      query.where(role: filter_param.value.to_s.split(","))
    }
  }
Let me know how it goes
Also let me know of any use case you want with dynamic filters and you hit obstacles, I can help you to set them up and also take notes to improve the documentation arround them, maybe add some tutorials as well
Hi @wide-waiter-22763 any feedback on this?
w
Sorry, somehow missed your answer. Our trial is ending and we are not subscribed for the dynamic filter addon, so I can't test this now - it looks good in general, however, I assume that it behaves like the tags field, meaning that label and value are the same, unlike a select, where I have a display value and a technical value? So the options would be "account_manager", "project_lead", since this is what goes to the database, and I can not make them read "Account Manager" and "Project Lead"?
l
> however, I assume that it behaves like the tags field, meaning that label and value are the same, unlike a select, where I have a display value and a technical value? Yes, you can also use different values and labels. 😄 Dynamic filters are very powerful, and they can support almost any use case you can think of
I'll share and example of value / label in a few moments
Play with it -> https://main.avodemo.com/avo/resources/projects?filters[status][array_is][]=done%2Cwaiting
> Our trial is ending and we are not subscribed for the dynamic filter addon, so I can't test this now Let's make sure this doesn't become an experience killer for you. We can extend your trial by a few days so you have enough time to experiment with Dynamic Filters. During that time, I'd be happy to help you build a few Dynamic Filter examples based on your specific use cases. That way, you can get a good feel for what's possible and decide whether it's a good fit for your needs
If that sounds helpful and you'd like to give it a try, just let me know.
w
Thanks for that example, that is really helpful! Putting that together won't be a problem, so I will not need an extension of the trial - but rather need to discuss with our stakeholders about extending our license 😇 👍
l
Cool!
If any questions come up or you'd like help validating a specific use case, just let me know. I'd be happy to help.
w
Thanks, this is very much appreciated!
2 Views