pagination-logic
Pure Javascript pagination logic without UI component
Installation
npm install pagination-logic
Usage
var pagination = ; /*Provide a pageObject(total -- Number of items that will be paginated single -- Number of items per page pageSize -- Number of pageItem that will be shown currentPage -- Number of the page you want to get pageLinkRule -- a funtion you link to the page you want, param is pageNumber)*/var paginationResult =
Result Attributes
Name | Description |
---|---|
pages | A list about the elements showed in current page, each elements contains {number, link, isActive} |
pageCount | total page number |
currentPage | the currently active page |
hasPrevious | whether the current page has previous page |
hasNext | whether the current page has next page |
pageSize | Number of elements showing in the current page |
previousPage | the previous page object which contains {number, link, isActive} |
nextPage | the next page object which contains {number, link, isActive} |
firstPage | the first page object which contains {number, link, isEllipsis}. ps: isEllipsis means whether you need '......', like 1...5,6,7,8...100 |
lastPage | the final page object which contains {number, link, isEllipsis}. ps: isEllipsis means whether you need '......', like 1...5,6,7,8...100 |
Example
const test = ;const logicPaginate = ; ;