Expand my Community achievements bar.

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

How can we enable and disable lazy loading in listing pages created in site view

Avatar

Level 1

Hello all,

 

In site view, when clicking on a parent page, its first set of child pages are listed, then next set will be listed as we scroll down. this will continue until all pages are listed. Is there a way to stop this and to list all sub pages once click on the parent page. I am using AEM 6.3.

 

Thanks and Regards,

Eranda

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Eranda_Kasturiratna ,

it sounds like you are trying to build a page catalogue with lazy loading. Assuming that JavaScript is an acceptable solution, then I would create a servlet that returns a list of pages via JSON format that accepts an offset parameter. The offset parameter is used to return a list of pages as the "next collection of pages", based on the offset.

Once the servlet have been created, you can write some JavaScript to request for the first collection of pages (from offset=0), and this will return for example the first 10 pages. On the initial load of the page, JavaScript will write the JSON response into the view.

When the page is scrolled to the near bottom of the page JavaScript will make another GET request (offset=1), so the next list of 10 pages will be returned, then JavaScript will write the JSON response into the view.

Next, when the page is scrolled down to the new near bottom of the page, make another GET request (offet=2), so the next list of pages will be returned, and so on...

I hope this helps.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@Eranda_Kasturiratna ,

it sounds like you are trying to build a page catalogue with lazy loading. Assuming that JavaScript is an acceptable solution, then I would create a servlet that returns a list of pages via JSON format that accepts an offset parameter. The offset parameter is used to return a list of pages as the "next collection of pages", based on the offset.

Once the servlet have been created, you can write some JavaScript to request for the first collection of pages (from offset=0), and this will return for example the first 10 pages. On the initial load of the page, JavaScript will write the JSON response into the view.

When the page is scrolled to the near bottom of the page JavaScript will make another GET request (offset=1), so the next list of 10 pages will be returned, then JavaScript will write the JSON response into the view.

Next, when the page is scrolled down to the new near bottom of the page, make another GET request (offet=2), so the next list of pages will be returned, and so on...

I hope this helps.