View Source Backpex.Filters.Range behaviour (Backpex v0.8.1)

The range filter renders two input fields of the same type. Backpex offers the :date, :datetime and the number type.

See the following example for an implementation of a date range filter.

defmodule MyAppWeb.Filters.DateRange do
  use Backpex.Filters.Range

  @impl Backpex.Filters.Range
  def type, do: :date

  @impl Backpex.Filter
  def label, do: "Date Range (begins at)"
end

Information

Note that the query function is already implemented via Backpex.Filters.Range.

use Backpex.Filters.Range

When you use Backpex.Filters.Range, the Backpex.Filters.Range module will set @behavior Backpex.Filters.Range. In addition it will add a render and render_form function in order to display the corresponding filter. It will also implement the Backpex.Filter.query function to define a range query.

Summary

Callbacks

The type return value defines the rendered input fields of the range filter.

Functions

Attributes

  • form (:any) (required)
  • type (:atom) (required)
  • value (:any) (required)

Attributes

  • value (:map) (required)

Attributes

  • form (:any) (required)
  • field (:atom) (required)
  • value (:any) (required)
  • type (:atom) (required)

Callbacks

@callback type() :: :date | :datetime | :number

The type return value defines the rendered input fields of the range filter.

Functions

Link to this function

do_query(arg, query, attribute)

View Source
Link to this function

maybe_parse(type, value, is_end? \\ false)

View Source
Link to this function

maybe_parse_range(type, start_at, end_at)

View Source
Link to this function

parse_float_or_int(value)

View Source
Link to this function

query(query, type, attribute, arg4)

View Source
Link to this function

range_input_set(assigns)

View Source

Attributes

  • form (:any) (required)
  • type (:atom) (required)
  • value (:any) (required)

Attributes

  • value (:map) (required)

Attributes

  • form (:any) (required)
  • field (:atom) (required)
  • value (:any) (required)
  • type (:atom) (required)