View Source Backpex.Fields.Currency (Backpex v0.8.1)
A field for handling a currency value.
Options
:debounce
- Optional integer timeout value (in milliseconds), "blur" or function that receives the assigns.:throttle
- Optional integer timeout value (in milliseconds) or function that receives the assigns.
Schema
Backpex.Ecto.Amount.Type
provides a type for Ecto to store a amount. The underlying data type should be an integer.
For a full list of configuration options see: https://hexdocs.pm/money/Money.html#module-configuration
schema "article" do
field :price, Backpex.Ecto.Amount.Type
...
end
schema "article" do
field :price, Backpex.Ecto.Amount.Type, currency: :EUR, opts: [separator: ".", delimiter: ","]
...
end
Example
@impl Backpex.LiveResource
def fields do
[
price: %{
module: Backpex.Fields.Currency,
label: "Price"
}
]
end