Flop.Phoenix.table

You're seeing just the function table, go back to Flop.Phoenix module for more information.
Link to this function

table(assigns)

View Source (since 0.6.0)

Specs

Generates a table with sortable columns.

The argument is a map with the following keys:

  • headers: A list of header columns. Can be a list of strings (or markup), or a list of {value, field_name} tuples.
  • items: The list of items to be displayed in rows. This is the result list returned by the query.
  • meta: The Flop.Meta struct returned by the query function.
  • path_helper: The Phoenix path or url helper that leads to the current page.
  • path_helper_args: The argument list for the path helper. For example, if you would call Routes.pet_path(@conn, :index) to generate the path for the current page, this would be [@conn, :index].
  • opts: Keyword list with additional options (see below). This list will also be passed as the second argument to the row function.
  • row_func: A function that takes one item of the items list and the opts and returns the column values for that item's row.

Available options

  • :for - The schema module deriving Flop.Schema. If set, header links are only added for fields that are defined as sortable.
  • :table_class - The CSS class for the <table> element. No default.
  • :symbol_class - The CSS class for the <span> element that wraps the order direction indicator in the header columns. Defaults to "order-direction".
  • :symbol_asc - The symbol that is used to indicate that the column is sorted in ascending order. Defaults to "▴".
  • :symbol_desc - The symbol that is used to indicate that the column is sorted in ascending order. Defaults to "▾".
  • :container - Wraps the table in a <div> if true. Defaults to false.
  • :container_class - The CSS class for the table container. Defaults to "table-container".

See the module documentation for examples.