Live demo
Demo source
Overview
Use table pagination below a table whose rows don't fit on one page. It moves page by page or to the first and last page, shows "Page 2 of 5" and the row total, and lets people choose 10, 25, 50 or 100 rows per page. It doesn't show page numbers; for numbered navigation through lists or results, use pagination.
Anatomy
Table pagination with five callouts: 1 marks the first-page button, 2 the previous-page button, 3 the Page 1 of 26 indicator, 4 the total of 254 rows, and 5 the page-size selector showing 10 per page.
- First and last page buttons jump to either end of the table;
hideFirstLastremoves them. - Previous and next page buttons move one page at a time;
hidePrevNextremoves them. Backward controls are disabled on the first page, and forward controls on the last.hideControlsremoves all controls. - Page indicator:
Page {pageIndex} of {pageCount}.pageIndexstarts at 0 in code but the label shows it from 1. - Row count:
Total: {rowCount} rows. - Page size selector: a select with
{pageSize} per pageoptions.
The labels are templates you can translate or shorten. An empty labelPage
or labelTotal hides that label.
Properties
| Design setting | Code | Mapping |
|---|---|---|
| Show controls | hideControls | Inverse setting; false keeps navigation visible. |
| First/last controls | hideFirstLast | Removes only the two end controls. |
| Previous/next controls | hidePrevNext | Removes only adjacent-page controls. |
| Page information | labelPage | Template using {pageIndex} and {pageCount}; an empty value hides it. |
| Row information | labelTotal | Template using {rowCount}; an empty value hides it. |
| Page size | pageSize, pageSizeOptions, labelPageSizeOption | Defaults to 10, with 10/25/50/100 options and a {pageSize} label template. |
| Current page | pageIndex | Zero-based; displayed page numbers are one-based. |
| Totals | pageCount, rowCount | Supplied by the application; both default to 0. |
| Changes | pageIndexChanged, pageSizeChanged | Emit the new numeric value. |
Look and feel
The design offers compositions with optional controls, counts and page-size
selection in Spark and Ocean, light and dark. Empty label templates hide the
counts, and the three hide* properties configure navigation. This version
always renders the page-size selector; there is no property to hide it.
Behavior
- Your application owns the rows. Pass
pageCountandrowCountfrom the data you show, and slice the visible rows frompageIndexandpageSize. - Return to the first page when the page size or a filter changes, so the current page always exists.
- Keep the pager close to the table it controls.
Accessibility
The host is a pagination navigation region. The design calls for meaningful names on all four paging buttons, a labelled page-size selector and an announcement after a page change. The current inner controls expose generic icon names and no explicit select label, so those naming requirements remain an implementation gap. Announce result/page changes from the application, for example through a polite status region.
Usage
Keep the controls and useful counts directly below the table. Removing all navigation leaves users unable to move between pages unless the application provides another navigation mechanism. Translate the label templates for the application's locale.
Related
Use with Datatable. For numbered links through lists or search results, use Pagination nav.