The type of objects contained in the array to be paginated
Private ReadonlyarrReadonlypageReadonlyrowReadonlytotalGets all pages as an array of page data. Warning: This can be memory-intensive for large datasets.
Array of all pages with their data
Gets metadata about the pagination without fetching data.
Object containing pagination metadata
Gets a range of page numbers for pagination UI. Useful for displaying "1 2 3 ... 8 9 10" style pagination controls.
Current page number
Number of pages to show on each side of current page (default: 2)
Array of page numbers to display
Retrieves the data rows for a specific page along with navigation information and metadata.
The page number to retrieve (1-based)
An object containing:
dataRows: Array of items for the requested pageprevPageNumber: Previous page number, or -1 if on first pagenextPageNumber: Next page number, or -1 if on last pagecurrentPage: The current page numbertotalPages: Total number of pageshasNext: Boolean indicating if there is a next pagehasPrev: Boolean indicating if there is a previous pagestartIndex: The starting index (0-based) of items on this pageendIndex: The ending index (0-based) of items on this pageChecks if there is a next page.
Current page number
True if there is a next page
Checks if there is a previous page.
Current page number
True if there is a previous page
Checks if a page number is valid.
The page number to validate
True if the page number is valid
An enhanced generic pagination utility class for dividing an array of items into pages.
Page numbers are 1-based (first page is page 1, not 0). Returns -1 for previous/next page numbers when at boundaries. Automatically adjusts the last row index if it exceeds the array length. Includes validation, utility methods, and immutability features.
Deprecated
Example