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
Pedro Garcia GPedro Garcia G 

Load a big data in a lightning:datatable

Hi...

I'm working in an app which loads a big with CSV file through a callout and shows it in the lightning:datatable. I want to reduce the time of loading.

The CSV has many columns then the Infinite scrolling of rows doesn't work for me.

I'm planning to show in the lightning:datatable.data few columns and in 'View Details' by row show the rest. As the example: https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/example#lightningcomponentdemo:exampleDatatableInAction

I appreciate any recomendation on how to do it.

Thanks,
Khan AnasKhan Anas (Salesforce Developers) 
Hi Pedro,

Greetings to you!

You can use lazy loading in lightning:datatable to load a large amount of data. Please refer to the below links which might help you further with the above requirement.

https://newstechnologystuff.com/2018/09/19/lightning-data-table-with-lazy-loading/

https://newstechnologystuff.com/2019/01/01/lightning-datatable-lazy-loading-with-inline-editing-and-actions/

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Pedro Garcia GPedro Garcia G
Hi Kan, thank you for your quick reply. The issue with the CSV is because it has more than 100 columns... the lazy loading doesn't work for me.

I'm looking for an option of showing a few columns in the lightning:datatable and load the rest of the column on click View more details button.

Is it the best way to do it?

Thanks,