This post describes, how to show Pagination on Lightning Datatable using reusable client side lightning pagination component. Pagination component is a reusable component and can be used any where using data table by passing two input parameters
currentPageNumber
maxPageNumber
Below are the steps to create a component to display the List of contacts and can able to paginate based on the records per page selection.
Step 1: Create a Pagination Component(Pagination.cmp)
Copy the below code to Pagination.cmp file
https://github.com/NagarjunaKaipu/myLightning/blob/master/ContactListDisplay.cmp
Copy the below js code to PaginationController.js file
https://github.com/NagarjunaKaipu/myLightning/blob/master/PaginationController.js
Step 2: Create Contact List component(ContactList.cmp)
Copy the below code to ContactList.cmp file
https://github.com/NagarjunaKaipu/myLightning/blob/master/ContactList.cmp
Copy the below js code to ContactListController.js file
https://github.com/NagarjunaKaipu/myLightning/blob/master/ContactListController.js
Step 3:
Test the component using Lightning Test Application(Test.app)
Sample Output:
Comments