Pagination computes the page count as Math.ceil(total / pageSize), and that one number decides how many page items render, whether the jumpers appear, whether prev and next are disabled and, by default, whether the size changer exists at all. It defaults to 0, so a Pagination with total left out renders one disabled item and nothing else.
- total counts items. Passing 20 because there are twenty pages gives you two.
- The server has to supply it. A page of rows does not know how many pages there are, so return the count with the rows.
- If the count is expensive to compute, use a different control instead of guessing. An approximate total makes the last page wrong, and the last page is the one readers check.
- It has to agree with the list underneath. A total of 240 beside a query that runs out at page 8 shows empty pages, and nothing warns about it.
- It changes when a filter changes. Refetch the count with the rows and reset current to 1 in the same update, or the reader lands on page 9 of a two-page result.