Expand description
Pagination — for data that arrives in pages, not for lists that are long.
Worth saying plainly, because the distinction is the whole reason this
module is small and late: a long list is answered by crate::scroll and
crate::list, which will show ten thousand rows and build nine of them. A
paginator earns its place only when the data is paged and the client
cannot hold the whole set — an API that answers “page 4 of 87”, a report with
a fixed page size, a backend that will not stream. There the page number is
not a scrolling affordance, it is the query.
What it contributes is one function. window turns (current, total) into
the row you see, and it is the part that is fiddly rather than obvious:
current = 6, total = 20 → 1 … 4 5 [6] 7 8 … 20
current = 2, total = 20 → 1 [2] 3 4 5 … 20
current = 3, total = 5 → 1 2 [3] 4 5Which page you are on, how many there are, and how to fetch one are all the
caller’s — as with crate::table’s sort, this module reports and paints.
Enums§
- Slot
- A place in the row: a page you can go to, or the mark for pages skipped.
Functions§
- ellipsis
- The mark for skipped pages. Inert on purpose — it is a statement about the row, not somewhere to go, so it takes no hover and no pointer cursor.
- page_
button - One page. The caller adds
.id/.on_click: a paginator that owned its clicks would have to own which page you are on, which is the caller’s whole reason for having one. - pagination
- The row. Fill it with
page_buttons,ellipsises andsteps. - step
- Previous or next, with
icons::glyph::ChevronLeft/icons::glyph::ChevronRight— the pair the calendar’s month header already uses. - window
- The pages to show for
currentoftotal, keepingaroundeither side.