ExTeal.Field behaviour (ExTeal v0.21.0) View Source
The core struct that represents a field on a resource served by ExTeal.
Link to this section Summary
Functions
Override the default filter for the field.
Use a getter function to display a computed field on the resource.
Define the options for the select field. The function accepts a list of
options that are either strings or maps with of value
and label
keys. If
the list members are strings, the value will be used for both the value and label
of the <option>
element it represents.
Link to this section Types
Specs
t() :: %ExTeal.Field{ as_html: term(), attribute: term(), can_see: term(), component: term(), embed_field: term(), field: term(), filterable: term(), getter: term(), name: term(), options: term(), panel: term(), pivot_field: term(), prefix_component: term(), private_options: term(), relationship: term(), sanitize: term(), show_on_detail: term(), show_on_edit: term(), show_on_index: term(), show_on_new: term(), sortable: term(), text_align: term(), type: term(), value: term() }
Link to this section Callbacks
Specs
Specs
default_sortable() :: boolean()
Specs
filterable_as() :: ExTeal.FieldFilter.valid_type()
Specs
Specs
sanitize_as() :: atom() | false
Specs
Link to this section Functions
Specs
Override the default filter for the field.
Use a getter function to display a computed field on the resource.
The getter function is given a schema and expects a string result
Define the options for the select field. The function accepts a list of
options that are either strings or maps with of value
and label
keys. If
the list members are strings, the value will be used for both the value and label
of the <option>
element it represents.
options
are expected to be an enumerable which will be used to generate
each respective option
. The enumerable may have:
keyword lists - each keyword list is expected to have the keys
:key
and:value
. Additional keys such as:disabled
may be given to customize the optiontwo-item tuples - where the first element is an atom, string or integer to be used as the option label and the second element is an atom, string or integer to be used as the option value
atom, string or integer - which will be used as both label and value for the generated select
Optgroups
If options
is a map or keyword list where the firs element is a string, atom,
or integer and the second element is a list or a map, it is assumed the key
will be wrapped in an <optgroup>
and teh value will be used to generate
<options>
nested under the group. This functionality is only handled in the UI for
select fields, boolean groups will not respond.
This functionality is equivalent to Phoenix.HTML.Form.select/3