datatable with pagination and checkbox cover

Custom Data Table With Pagination And Checkbox Functionality In Salesforce Lightning

Lightning Component

Hello guys, today in this post we are going to learn how we can create custom lightning data table with client side JavaScript pagination buttons and row level checkbox functionality using salesforce lightning component. In this component we’ll also persist checkbox checked state on pagination.

Component Features Highlights : 
  • Client Side JavaScript Pagination.
  • Inline Checkbox Functionality.
  • Get Selected Rows in Controller.
  • Total Records Count
  • Selected Records Count
  • Select/Deselect All Checkbox
datatable with pagination and checkbox demo
Lightning Component Output

Apex Controller : dataTableCtrl

  • Check code comments.

Lightning Component : tableWithPC.cmp

  • Check code comments.

JavaScript Controller : tableWithPCController.js

  • check code comments

JavaScript Helper : tableWithPCHelper.js

  • Check code comments.
Test App :

Output :

data table with pagination and checkbox demo
Lightning Component Output

Other popular Post :

Like our facebook page for new post updates. & Don’t forget to bookmark this site for your future reference.

Happy Learning 🙂



  • Hi,

    Thanks for the code…. Works… i just have one doubt… i’m using this for a custom object where there are approx 20k records, but the table only displays 882.

    Can you let me know how i can display all the records?


    Thanks in advance

  • Can we add inline ediying for picklist fields in addition to wrapper n pagination. Can we do using lighting datatable fpr picklist values? Though its a limitation.Pla suggest

  • hey Piyush…This is great..can we add inline editing of picklist fields to this component?Should we go the parent/child component route or can it be achived with the same component you described here.


    Appreciate your help.

  • Hi Piyush,

    Can we edit the existing records(show as an input box) which displayed in table and when checkbox is checked, we create a new records with updated values which is changed by user for checked record? This functionality can be achieved using above code with some changes ?

  • I Wonder what’s the meaning of this piece of code
                   if (component.find(“selectAllId”).get(“v.value”)) {

  • Hi piyush,

    From server Side List List is filled but in while passsing frim Client Side to server side list is going null .means Object are there in List but all they are null.

  • how can load the data faster in jquery datatable, I am using more than 10 accordion section in my component, Each section I am showing more than 500 records, but it takes time to load more than 3 min.

    Anyone can help me on this ??

  • Hi Piyush bro, i wanted a small help with the customLookup component that you’ve created.
    The component works wonderfully. Only thing which I cannot find the solution of is that the result of the search thats the ‘Lightning Pill’. Its text is aligned always to the center. i want it in the left. Can you please help!

Leave a Reply