Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Pagination using content fragment list component

Avatar

Avatar
Validate 1
Level 2
ashishkhadpe
Level 2

Likes

4 likes

Total Posts

48 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
ashishkhadpe
Level 2

Likes

4 likes

Total Posts

48 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Boost 3
Boost 1
View profile
ashishkhadpe
Level 2

07-05-2020

Hi All,

 

Any suggestion on how we can implement the pagination logic using the core content fragment list component.

 

May be extending com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragmentList class but not sure if we can do that.

 

Thanks in advance.

content fragments

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
Theo_Pendle
MVP

Likes

236 likes

Total Posts

251 posts

Correct Reply

105 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 10
Ignite 1
View profile

Avatar
Validate 1
MVP
Theo_Pendle
MVP

Likes

236 likes

Total Posts

251 posts

Correct Reply

105 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 10
Ignite 1
View profile
Theo_Pendle
MVP

08-05-2020

Hello @ashishkhadpe,

The quick answer is no, you can't extend com.adobe.cq.wcm.core.components.models.contentfragment.ContentFragmentList, for two reasons:

  1. It's an interface (which allows extension, but that yon't help you implement pagination)
  2. The actual implementation, com.adobe.cq.wcm.core.components.internal.models.v1.contentfragment.ContentFragmentListImpl, is not exported in OSGi, so if you extend it and deploy your bundle, you'll get a dependency error.

If you want to "extend" the behavior of the you'll have to use the Delegation Pattern. You can find a tutorial explaining this pattern in AEM here. If you are using Lombok (and I think you should), you can use their @Delegate annotation to reduce on boilerplate code.

However, I assume that you are thinking of pagination as a front-end process (ie: no need to reload the entire page when you go from page 1 to page 2)? In that case, you'll have to implement the pagination logic in JS (using a web component for example, I recommend https://open-wc.org/). Then create a Sling Servletor Model that you can call to get X results at a time. 

Hope this helps! 🙂

Answers (0)