Multi-select filter: a dropdown of checkboxes for choosing any number of values, showing how
many are chosen. Takes options ({label, value} tuples), match_mode, and prompt (the
dropdown's text when nothing is chosen).
Values from the client
Selections arrive from the browser (the URL, or the form), so they're trimmed before
they reach the query: duplicates are dropped, and only values among the filter's
options are kept when it has any. Without options, at most 100 values are kept.
Match Mode Options
The match_mode option controls how multiple selections are combined:
:any(default) - Shows records containing ANY of the selected values (OR logic):all- Shows records containing ALL of the selected values (AND logic)
Examples
# ANY logic - show books with at least one selected tag
<:col
field="tags"
filter={[type: :multi_select, options: [{"Fiction", "fiction"}, {"Romance", "romance"}]]}
/>
# ALL logic - show books that have all selected tags
<:col
field="tags"
filter={[
type: :multi_select,
options: [{"Fiction", "fiction"}, {"Bestseller", "bestseller"}],
match_mode: :all
]}
/>Array Fields
On an array field (an array attribute, a list aggregate or an array calculation), a
record matches when its array holds the selected values. Through a to-many relationship
(albums.tags, albums.genre), :all means the related records hold every value between
them. On a plain field of the record itself, match_mode has no effect: a record matches
any of the values.