v0.9
Paginator
class Paginator → file: core/lib/Paginator.jsA library which offers a robust pagination solution, empowering developers to implement smooth and user-friendly pagination functionality effortlessly in their web applications.
Instance
Instance created withnew Paginator(linksSize, currentPageClasses)
.
Properties
Property | Description | Type | Default |
---|---|---|---|
linksSize | the number of links which will be shown | number | 5 |
currentPageClasses | the CSS classes which marks the active page, usually it's <<i class="active"> |
string[] | ['active'] |
Methods
page(currentPage, itemsTotal, itemsPerPage) :object
Calculate the page links and make current page active.Returned object:
{ pageLinks:{i:number, c:string[]}[], pagesTotal:number }
where i is iteration number and c is the current (active) page CSS classes.
-
ARGUMENTS:
- currentPage :number - the number of current page
- itemsTotal :number - the total number of listed items
- itemsPerPage :number - number of items on the page
skipCalc(currentPage, itemsPerPage) :number
Calculate the skip number, i.e. how many items to skip.-
ARGUMENTS:
- currentPage :number - the number of current page
- itemsPerPage :number - number of items on the page
ordCalc(currentPage, itemsPerPage, i) :number
Calculate the table ordinal number #.-
ARGUMENTS:
- currentPage :number - the number of current page
- itemsPerPage :number - number of items on the page
- i :number - table row number: 0, 1, 2, ...
Stackblitz Examples
- Paginator - the pagination library