Skip to content

Pagination

Simon edited this page Jul 20, 2016 · 2 revisions

Pagination

The pagination is displayed by the partial search/pagination.html. The main data use by the partial is stored on the object pagination. This object is build by lib/transform/search-results-to-template-data.js and especially by the createPagination function

The pagination object

{
    totalPages: 
    pageNumber: // from 1
    isFirst: 
    isLast: 
    isPageSize50: 
    isPageSize100:
    links: {
      self
      first
      last
      prev
      next
    }
}
  • createPagination(queryParams, results, rootUrl)
    • initialise pageNumber (index from 0) and pageSize from queryParams properties
    • intialise page variable by calling Pagination.page
  • Pagination.page(currentPageNumber, totalPages, opts)
    • currentPageNumber is pageNumber
    • totalPages is results.meta.total_pages
    • opts is an object with one property, createPageLink which is a function
Clone this wiki locally