Beacon.LiveAdmin.PageBuilder.Table (Beacon LiveAdmin v0.4.2)
View SourceRepresents a Table in the LiveAdmin UI, with pagination, filtering, and sorting.
Summary
Functions
Initializes a new Table
struct.
Generates a path to navigate from the current page to another given page.
Updates the current page based on incoming params and a count_fn
which returns the number of
items which have already been seen.
Generates a path for the next page of a paginated table.
Generates a path for the previous page of a paginated table.
Creates a list of query params based on the existing params in a given table
and a new set of incoming params.
Pushes updated Table data to the websocket.
Types
Functions
Initializes a new Table
struct.
Options
sort_by
- (required) the field on which to sort the table contentsper_page
- the number of items to display per page (defaults to 15)
@spec goto_path( Phoenix.LiveView.Socket.t(), Beacon.LiveAdmin.PageBuilder.Page.t(), Beacon.LiveAdmin.PageBuilder.Page.t() ) :: String.t()
Generates a path to navigate from the current page to another given page.
If the current and goto pages are the same, it will still append table params to the path.
Usage
<.link patch={Table.goto_path(@socket, @page)}>
@spec handle_params( Phoenix.LiveView.Socket.t(), map(), (Beacon.LiveAdmin.PageBuilder.Page.t() -> integer()) ) :: Phoenix.LiveView.Socket.t()
Updates the current page based on incoming params and a count_fn
which returns the number of
items which have already been seen.
Can be called as a helper inside a Beacon.LiveAdmin.PageBuilder.handle_params/3
callback when
updating params for a Table.
@spec next_path(Phoenix.LiveView.Socket.t(), Beacon.LiveAdmin.PageBuilder.Page.t()) :: String.t()
Generates a path for the next page of a paginated table.
Usage
<.link patch={Table.next_path(@socket, @page)}>
@spec prev_path(Phoenix.LiveView.Socket.t(), Beacon.LiveAdmin.PageBuilder.Page.t()) :: String.t()
Generates a path for the previous page of a paginated table.
Usage
<.link patch={Table.prev_path(@socket, @page)}>
Creates a list of query params based on the existing params in a given table
and a new set of incoming params.
The existing and incoming params will be merged, with precedence for the latter (incoming will overwrite existing).
@spec update( Phoenix.LiveView.Socket.t(), keyword() ) :: Phoenix.LiveView.Socket.t()
Pushes updated Table data to the websocket.
The Beacon Page containing the table will be automatically updated