pub struct TablePage<M> {
pub rows: Vec<M>,
pub next_cursor: Option<String>,
pub prev_cursor: Option<String>,
}Expand description
One executed page of rows for Table::render.
Build it from toasty’s Page via Self::from_toasty_page, which
URL-encodes the engine cursors; a Vec<M> converts directly into a page
with no neighbors. An absent cursor simply means no Previous/Next link is
rendered — the chrome never invents pages.
Fields§
§rows: Vec<M>The rows of this page.
next_cursor: Option<String>Encoded cursor for the next page (?after=), when one exists.
prev_cursor: Option<String>Encoded cursor for the previous page (?before=), when one exists.
Implementations§
Source§impl<M: Model> TablePage<M>
impl<M: Model> TablePage<M>
Sourcepub fn from_toasty_page(page: Page<M>) -> Result<Self>
pub fn from_toasty_page(page: Page<M>) -> Result<Self>
Wrap a toasty cursor-pagination result, encoding its cursors for URLs.
§Errors
Errors when a cursor contains a value the URL codec cannot represent
(see crate::cursor).
Source§impl<M> TablePage<M>
impl<M> TablePage<M>
Sourcepub async fn load(
cx: &Cx,
table: &Table<M>,
query: Query<List<M>>,
state: &TableState,
) -> Result<Self>
pub async fn load( cx: &Cx, table: &Table<M>, query: Query<List<M>>, state: &TableState, ) -> Result<Self>
Load the page of table that state names: query with the table’s
search, filters and ordering applied, the relations its columns declare
included, and cursor pagination at its page size.
query is the caller’s scope. The panel’s list passes the resource’s
scoped_query; a page that owns its
table passes its own, with the table from
panel::wired_table when it renders the
resource’s action chrome.
§Errors
A malformed cursor, a cursor the engine rejects for this ordering (both take the cursor-stripped retry contract), or a database failure.