Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Pagination in CQ5

Avatar

Former Community Member

Hi friends,

     How pagination can be achieved in CQ5?

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 7

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

View solution in original post

2 Replies

Avatar

Correct answer by
Level 7

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