Pagination
Overview
When your application retrieves data, the amount of data retrieved is either bounded — meaning you have at least a rough idea how much data is coming back — or the amount of data retrieved is unbounded.
When the amount of data is unbounded, it’s best to retrieve the data in discrete chunks. Retrieving data can be costly in terms of server, network, and client resources. Since you won’t know which parts of the unbounded data the user is interested in (beyond any search parameters provided), it’s best not to attempt to retrieve all of the data at once.
After your app has retrieved one or more discrete chunks of data, you can use a pagination approach where one “page” of data is displayed at a time. The user is typically given options to move to the next or previous page, or even a specific page, but only one page displays at a time. This approach lends itself to displaying listings, search results, and photo galleries. Many users like to see all options at once, so offer the user a “View all” option if feasible.
Development
Web component development
Component reference
rui-data-pager
Displays links to pages of data, indicating the current page
Name | Type | Default | Description |
---|---|---|---|
pageIndex | number | 1 | 1-based index of the current data page |
totalItems | number | 0 | The total number of data items |
itemsPerPage | number | 10 | The maximum number of data items to display in a data page |
maxPageButtons | number | 0 | Set this to a value greater than zero if you want to cap the number of data pages shown in the pagination component. This can be useful in reducing the number of page buttons displayed in the data pager when a very large number of data items exist for the user to page through. If greater than zero, than no more than the specified number of data page buttons display, with a range that keeps the current data page in the middle. |
previousText | string | 'Previous' | Text displayed in the button that takes the user to the previous page of data |
firstText | string | 'First' | Text displayed in the button that takes the user to the first page of data |
nextText | string | 'Next' | Text displayed in the button that takes the user to the next page of data |
lastText | string | 'Last' | Text displayed in the button that takes the user to the last page of data |
isDisabled | boolean | false | Specifies whether the data pager is disabled. |
rui-data-pager-page-index-change | event | Event fired when the data page index changes. The event detail specifies the current data page index. |
Implementation
Begin by importing the rui-data-pager
module into your application.
Use the rui-data-pager
element for pagination.
Angular wrapper development
Wrapper reference
ngx-bootstrap pagination
Displays links to pages of data, indicating the current page
Implementation
Begin by importing the PaginationModule into your application.
Use the pagination
element for pagination.
Design
Figma design
Dev Component | Design Component Name |
---|---|
Pagination first button | RUI / Pagination / First Available values for the State property:
|
Pagination previous button | RUI / Pagination / Previous Available values for the State property:
|
Pagination page button | RUI / Pagination / Page Switch on the Active property for the active page in the pagination list |
Pagination next button | RUI / Pagination / Next Available values for the State property:
|
Pagination last button | RUI / Pagination / Last Available values for the State property:
|
If you want to show an example of pagination buttons in an artboard, add an appropriate combination of Previous, page number, and Next buttons:
- If you’re showing the first page button as active, then the Previous button is disabled but all other buttons are enabled.
- If you’re showing a “middle” page as active, then all buttons are enabled.
- If you’re showing the last page button as active, then the Next button is disabled but all other buttons are enabled.
- Only show one of the page buttons as active.
Adobe XD design
- Sample App - Large Datasets
Dev Component | Design Component Name |
---|---|
Pagination previous button - enabled | JHA / Pagination / Previous / Enabled |
Pagination previous button - disabled | JHA / Pagination / Previous / Disabled |
Pagination page button - active | JHA / Pagination / Page / Active |
Pagination page button - inactive | JHA / Pagination / Page / Inactive |
Pagination next button - enabled | JHA / Pagination / Next / Enabled |
Pagination next button - disabled | JHA / Pagination / Next / Disabled |
If you want to show an example of pagination buttons in an artboard, add an appropriate combination of Previous, page number, and Next buttons:
- If you’re showing the first page button as active, then the Previous button is disabled but all other buttons are enabled.
- If you’re showing a “middle” page as active, then all buttons are enabled.
- If you’re showing the last page button as active, then the Next button is disabled but all other buttons are enabled.
- Only show one of the page buttons as active.