A generic wrapper that encapsulates a list of data items and its associated pagination metadata.
Wrapping search results with Paginable
const pagination = new Pagination({ page: 1, perPage: 2 });const result = new PaginationResult(pagination, 5);const items = ['apple', 'banana'];const paginable = new Paginable(items, result);console.log(paginable.data); // ['apple', 'banana']console.log(paginable.pagination.total); // 5 Copy
const pagination = new Pagination({ page: 1, perPage: 2 });const result = new PaginationResult(pagination, 5);const items = ['apple', 'banana'];const paginable = new Paginable(items, result);console.log(paginable.data); // ['apple', 'banana']console.log(paginable.pagination.total); // 5
The type of items in the data array.
Creates an instance of Paginable.
Paginable
The array of items on the current page.
The pagination metadata.
The paginated subset of items.
The pagination metadata associated with the data subset.
A generic wrapper that encapsulates a list of data items and its associated pagination metadata.
Example
Wrapping search results with Paginable