Closed ghenry closed 11 months ago
Nevermind!
I scrolled up in:
iex(1)> h(Flop.Phoenix.filter_fields/1 )
and can see:
The fields can be passed as atoms or keywords with additional options.
fields={[:name, :email]}
Or
fields={[
name: [label: gettext("Name")],
email: [
label: gettext("Email"),
op: :ilike_and,
type: "email"
],
age: [
label: gettext("Age"),
type: "select",
prompt: "",
options: [
{gettext("young"), :young},
{gettext("old"), :old)}
]
]
]}
Available options:
• label - Defaults to the humanized field name. • op - Defaults to :==. • type - Defaults to an input type depending on the Ecto type of the filter field.
Any additional options will be passed to the input component (e.g. HTML classes or a list of options).
Going to leave this here for my future self.
Hi all,
Where do I actually set this?
https://hexdocs.pm/flop/Flop.Schema.html#module-filtering
In my
FilterComponent
or inhandle_event("update-filter", params, socket)
?I have a component like this https://github.com/woylie/flop_phoenix#filter-forms
I'd like to get a default.
Thanks.