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
Ruchi Gupta KeshriRuchi Gupta Keshri 

how to list more then 50000 record using Data table in lwc

can someone help me with this
how to list more then 50000 record using Data table in lwc please help.
 
Best Answer chosen by Ruchi Gupta Keshri
mukesh guptamukesh gupta
Hi Ruchi,

Pagination only option for this issue, so please follow below url:-

https://www.biswajeetsamal.com/blog/salesforce-lwc-custom-datatable-pagination/


if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh

All Answers

VinayVinay (Salesforce Developers) 
Hi Ruchi,

Check below reference which has details on how to bypass 50k limitation.

https://salesforce.stackexchange.com/questions/344154/lwcs-apex-query-returns-more-than-50k-results-how-to-bypass-this-limitation

Please mark as Best Answer if above information was helpful.

Thanks,
Ruchi Gupta KeshriRuchi Gupta Keshri
NOT working..............page not load properly
any other way? Please Help


public with sharing class AccountData {
@AuraEnabled(cacheable=true)
public static List<AggregateResult> getAccData(){
    try {
        List<AggregateResult> results =new List<AggregateResult>();
        for (List<AggregateResult> agg: [select id,Name,Phone from Account group by id,Name,Phone]){
            results.addAll(agg);
        }
        return results;
    } catch (Exception e) {
        throw new AuraHandledException(e.getMessage());
    }
}
}


import { LightningElement, track, wire } from 'lwc';
import getAccData from '@salesforce/apex/AccountData.getAccData';
export default class NavigateToRecord extends LightningElement {
    @track columns = [
        {label: 'Name',
        fieldName: 'nameUrl', type: 'url',
        typeAttributes: {
            label: {
                fieldName: 'Name'
            }
        }
     },
        { label: 'Id', fieldName: 'Id'},
        {label:'Phone', fieldName:'Phone'}
    ];
    @track accountList;

    @wire(getAccData)
    getAccDataall({data,error}){
        if(data){
           // this.accountList=data;
            let nameUrl;
            this.accountList = data.map(row => { 
                nameUrl = `/${row.Id}`;
                return {...row , nameUrl} 
            })
            console.log(data);
        }
        else if(error){
            console.log(error);
        }
    }
}

<template>
    <template if:true={accountList}>
        <lightning-datatable
        key-field="id"
        data={accountList}
        columns={columns}
        ></lightning-datatable>
    </template>
</template>
mukesh guptamukesh gupta
Hi Ruchi,

Pagination only option for this issue, so please follow below url:-

https://www.biswajeetsamal.com/blog/salesforce-lwc-custom-datatable-pagination/


if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh
This was selected as the best answer