View Source Backpex.Filters.MultiSelect behaviour (Backpex v0.8.2)
The multi select filter renders checkboxes for a given list of options, hence allowing the user to select multiple values.
See the following example for an implementation of a multi select user filter.
defmodule MyAppWeb.Filters.MultiUserSelect do
use Backpex.Filters.MultiSelect
@impl Backpex.Filter
def label, do: "User"
@impl Backpex.Filters.MultiSelect
def prompt, do: "Select user ..."
@impl Backpex.Filters.MultiSelect
def options, do: [
{"John Doe", "acdd1860-65ce-4ed6-a37c-433851cf68d7"},
{"Jane Doe", "9d78ce5e-9334-4a6c-a076-f1e72522de2"}
]
end
use Backpex.Filters.MultiSelect
When you
use Backpex.Filters.MultiSelect
, theBackpex.Filters.MultiSelect
module will set@behavior Backpex.Filters.Select
. In addition it will add arender
andrender_form
function in order to display the corresponding filter.
Summary
Functions
Attributes
value
(:any
) (required)options
(:list
) (required)
Attributes
form
(:any
) (required)field
(:atom
) (required)value
(:any
) (required)options
(:list
) (required)prompt
(:string
) (required)
Callbacks
The list of options for the multi select filter.