Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

AEM 6.5 : add pagination to list

Avatar

Level 2

Hi,

We are implementing a complex list that shows elements with a title, a description, an image and a link. I would like to know what is he best way to implement pagination using only frontend logic ?

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

We have implemneted the list component with pagination, which get the child pages title, description and image and create a list item with a link.

we created a json service and servlet, which return relavent results based on paginagion, you can pass page number in the json request when click on paginations and get the pagination results at front end side and create a result DOM based on json response, you can use the Query Builder API which support the pagination properties if running queries to fetch pages title, description etc..



Arun Patidar

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hi,

We have implemneted the list component with pagination, which get the child pages title, description and image and create a list item with a link.

we created a json service and servlet, which return relavent results based on paginagion, you can pass page number in the json request when click on paginations and get the pagination results at front end side and create a result DOM based on json response, you can use the Query Builder API which support the pagination properties if running queries to fetch pages title, description etc..



Arun Patidar

Avatar

Community Advisor

@manal-ghanim , you can use pagination from the front-end purely. We had  implemented it with the help of one open source JS library named Data tables.

It is pretty much easy to use.

More details you can get it on below urls:

https://datatables.net/

 

Hope this will help.

Umesh Thakur

Avatar

Level 2
@Umesh_Thakur, does datable have an option to display complex data instead of tabular info ? Basically, I wish to render AEM list items and apply paging.

Avatar

Community Advisor
If was able to populate list of JOSN object into it then you can too. It seems it is doable with that.

Avatar

Community Advisor

Hi Manal-ghanim, 

 

I am facing an issue to implement a proper site pagination, or element pagination, can you please guide me to achieve this via custom code, thanks in advance