API/libsapojs/SAPO/Utility/Pagination

[Elements] are optional

Class SAPO.Utility.Pagination


class SAPO.Utility.Pagination
Provides pagination to a page requires SAPO.Utility.Url
Defined in Utility/Pagination/0.1/lib.js

Constructor Summary
Pagination ([Object options])

Function Summary
gets the current page from the url
DOMElement getLinks ([Number page])
selector function to get the links depending on the mode
DOMElement getLinksModeSlide ([Number page])
calculates the links to display on the pagination - in slide mode
DOMElement getLinksWithoutMode ([Number page])
calculates the links to display on the pagination - no slide mode
gets the total number of pages
init()
constructor alias
Boolean isFirstPage()
checks if the currentPage is the first one
Boolean isLastPage()
checks if the current page is the last page
replaceUrlAnchor (Number page)
sets the page number in the url
setCallBack (Function callBack)
sets the callBack function

Constructor Details

constructor Pagination

Pagination([Object options])
Parameters:
[options]
  • [ String urlVar ] - variable to be used on the url to provide change of the page
  • [ Number perPage ]
  • [ Number totalItems ] -
  • [ String mode ] - accepts only 'slide'
  • [ Boolean anchorLink ] - append an anchor link to the current page link. True by default
  • [ Number delta ]
  • [ String delimiter ]
  • [ Function callback ]

Function Details

function getCurrentPage

getCurrentPage()
gets the current page from the url

function getLinks

DOMElement getLinks([Number page])
selector function to get the links depending on the mode
Parameters:
[page]
Returns:
the link DOMElement

function getLinksModeSlide

DOMElement getLinksModeSlide([Number page])
calculates the links to display on the pagination - in slide mode
Parameters:
[page] - the page number
Returns:
the links element

function getLinksWithoutMode

DOMElement getLinksWithoutMode([Number page])
calculates the links to display on the pagination - no slide mode
Parameters:
[page] - the page number
Returns:
the links element

function getTotalPages

getTotalPages()
gets the total number of pages

function init

init()
constructor alias

function isFirstPage

Boolean isFirstPage()
checks if the currentPage is the first one
Returns:
true if it is the first page

function isLastPage

Boolean isLastPage()
checks if the current page is the last page
Returns:
true if it is the current page

function replaceUrlAnchor

replaceUrlAnchor(Number page)
sets the page number in the url
Parameters:
page

function setCallBack

setCallBack(Function callBack)
sets the callBack function
Parameters:
callBack