Pagination.PaginationHelper (simple_pagination v0.2.0)
This module contains helper functions to create the following components:
- order_by buttons
- page links
- filters
Check Pagination.Paginator
for a complete example.
Link to this section Summary
Functions
Provides a link to order following a given field
Provides links for pages 1...N and a select box for number of items per page.any()
if delta
is provided as an argument, it'll modify the boundaries around the current
page. Default value for delta
is 1.
Generates inclusive filters (filter1 and filter2 and ...)
Link to this section Functions
order_tag(assigns)
Provides a link to order following a given field
<.order_tag label="id"
order_by={:id}
paginator={@things}
arrows={%{asc: "A-Z", desc: "Z-A"}}/>
page_tag(assigns)
Provides links for pages 1...N and a select box for number of items per page.any()
if delta
is provided as an argument, it'll modify the boundaries around the current
page. Default value for delta
is 1.
The options for the number of items per page are defined in Pagination.PaginatorState
per_page_items: [5, 10, 25, 0]
0 stands for: all records
<.page_tag
paginator={@things}
delta={2} />
search_filter_tag(assigns)
Generates inclusive filters (filter1 and filter2 and ...)
Filters are defined in Pagination.PaginatorState
as tuples {field, label}
filters: [id: "UID", title: "Item Title", field: "Label"]
The button text can be configured using label
<.search_filter_tag
paginator={@things}
label="Find" />