Sunday, June 7, 2020

Lazy Loading implementation in Lightning Web Components

    To load more data in Salesforce lightning in tabular form, will cause performance issue to load data on page or application get slow down, if there is no pagination applied on table. To overcome from this problem, we can use Lightning:Datatable with infinite loading data with help of specific Offset.
  • Use lightning:datatable in Lightning Web Component
  • enable-infinite-loading attribute at client side
  • Data should retrieve only when requested 
  • When user scroll down the table to see more records in table, application should render next coming records.
  • Records to be retrieved in chunks.
To get it done as practical please follow below example.

Example: Grab all existing Accounts in a table with using lazy loading.

accountsList.html