Pagination in CQ5 | Community
Skip to main content
October 16, 2015
Solved

Pagination in CQ5

  • October 16, 2015
  • 2 replies
  • 815 views

Hi friends,

     How pagination can be achieved in CQ5?

Thanks in advance

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ojjis

Hi,
there is as Sham suggested a common CQ way where the results from an operation is divided into result pages that each holds a certain number of results leading to an easy way of handling paginations. However if you consider to use you own component with your own special pagination you have to manage this yourself. The easiest way here would be to make use of the sling selectors(mypage.1.html) for this, and then handle these on the component level.

One could of course make use of querystrings (mypage.html?page=1) but as you probably know, that has it's limitations when it comes to caching etc.
So basically it's all up to you which one you prefer. There is a great api for handling the url where you can get the information from the request (request pah info). You can check this out here: https://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/commons/PathInfo.html.
Here you will be able to get selectors, suffixes and also extensions.

/Johan

2 replies

Ojjis
OjjisAccepted solution
Level 7
October 16, 2015

Hi,
there is as Sham suggested a common CQ way where the results from an operation is divided into result pages that each holds a certain number of results leading to an easy way of handling paginations. However if you consider to use you own component with your own special pagination you have to manage this yourself. The easiest way here would be to make use of the sling selectors(mypage.1.html) for this, and then handle these on the component level.

One could of course make use of querystrings (mypage.html?page=1) but as you probably know, that has it's limitations when it comes to caching etc.
So basically it's all up to you which one you prefer. There is a great api for handling the url where you can get the information from the request (request pah info). You can check this out here: https://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/commons/PathInfo.html.
Here you will be able to get selectors, suffixes and also extensions.

/Johan

Sham_HC
Level 10
October 16, 2015

Out of the box search component has an example. Refer http://localhost:4502/content/geometrixx/en/toolbar/search.html?q=geometrixx