Gruber
Gruber

Reputation: 2308

How can I implement multiple instances of pagination in Algolia instant search?

Just as title, how can I place multiple pagination widgets on the same page with Algolia Instant Search? Simply put I'd like to have a pagination right at the top of the results and another one at the bottom.

I tried giving as container an array via document.querySelectorAll('.pagination') instead of a single element, unfortunately it doesn't work returning error in console

Error: Container must be string or HTMLElement.

Upvotes: 2

Views: 739

Answers (1)

redox
redox

Reputation: 2319

To add multiple instances of the instantsearch.js pagination widget you just need to add it several times to your instantsearch instance:

search.addWidget(
  instantsearch.widgets.pagination({
    container: '#pagination-container-1'
  })
);

search.addWidget(
  instantsearch.widgets.pagination({
    container: '#pagination-container-2'
  })
);

Upvotes: 4

Related Questions