class
SAPO.Utility.Pagination
Provides pagination to a page
See also:
Version:
3.1
Since:
Defined in
Utility/Pagination/3.1/lib.js
June 2011
Constructor Summary
Pagination
([Object
options])
Function Summary
gets the current page from the url
selector function to get the links depending on the mode
calculates the links to display on the pagination - in prevNext 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
setCallback
(Function
callback)
sets the callback function
Constructor Details
constructor Pagination
Pagination([Object
options])
Parameters:
[options]
-
Number totalItems
- number of items to paginate -
[ Number itemsPerPage ]
- number of items that get displayed on each page -
[ Number delta ]
- number of neighbour items displayed around the current page (on mode slide) -
[ String urlVar ]
- variable to be used on the url to provide change of the page -
[ String mode ]
- one of ['slide', 'prevNext'] -
[ String firstText ]
- text to display on the first element (mode prevNext) -
[ String previousText ]
- text to display on the previous element (mode prevNext) -
[ String nextText ]
- text to display on the next element (mode prevNext) -
[ String lastNext ]
- text to display on the last element (mode prevNext) -
[ String disabledElement ]
- element which holds each disabled element -
[ String enabledElement ]
- element which holds each enabled element -
[ String container ]
- top element -
[ String linkWrapperContainer ]
- will wrap each page element if defined -
[ String currentPageClass ]
- class to assign to the current page element -
[ String containerClass ]
- class to assign to the container -
[ String linkWrapperContainerClass ]
- class to assign to link wrapper elements (if linkWrapperContainer is defined) -
[ Function callback ]
- called when a button is clicked (ev, pageNr)
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 getLinksModePrevNext
DOMElement
getLinksModePrevNext([Number
page])
calculates the links to display on the pagination - in prevNext 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 setCallback
setCallback(Function
callback)
sets the callback function
Parameters:
callback