Do you have a requirement to create pagination in Lightning Component? Well, there are two ways to implement it:
- Using server-side controller call for every page
- Fetching data once and using the client-side controller for every page
In this article, we will use the client-side controller to implement pagination:
Component – LightningPaginationClientSide.cmp
Client-Controller – LightningPaginationClientSideController.js
Client-Helper – LightningPaginationClientSideHelper.js
Style – LightningPaginationClientSide.css
Below would be the output of above code:
Which approach should I use:
- If I am dealing with records less than 10k, I would go for client-side controller approach.
- Anything above than 10k, I would go for server-side controller approach with client-side cache for better performance.
This completes Lightning Pagination series. Stay tuned for some awesome articles.