function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric-aejeEric-aeje 

How to make a lazy loader with a LWC for:each loop?

Can someone help me find an example or or how to make a lazy loader like this but with a for:each loop ?

I'm getting data from an apex class

public without sharing class Controller {

    @AuraEnabled (cacheable = true)
    public static List<Case> getCaselist() {

        try {
            return [
            SELECT Id, CaseNumber, Status, Description, CreatedDate
            FROM Case 
            ];
        } 
        catch(Exception e) {
            throw new AuraHandledException('Something went wrong:'+ e.getMessage());
        }
    }

HTML:

<template for:each={recordList} for:item="c" for:index="index">
    <div class="table-row" key={c.Id}>
        <div class="table-col">
            {c.Status}
            {c.Description}
            {c.CreatedDate}
        </div>
    </div>
</template>
 

 

http://amitsalesforce.blogspot.com/2020/07/lazy-loading-in-lightning-web-component.html

ANUTEJANUTEJ (Salesforce Developers) 
Hi Eric,

I checked and I see that there is only similar kind of examples that you have mentioned, is there any reason why you need to specifically do only with for:each ?

Looking for your response.

Thanks.
Eric-aejeEric-aeje
It needs to be displayed on a community page and has heavy styling needs.
Eric-aejeEric-aeje
I am also customizing the html with slds classes and custom classes to adjust the layout and feel.