Posted in Salesforce

Salesforce Lightning : Datatable with Selectable Rows and Pagination

Customizing the Lightning Datatable is quite easy with Salesforce. Here is a simple and sample code with with 3 pages, getting data dynamically for every pagination and selectable rows with memory on every page.

Link to the code repository:

Page 1
Page 2
Page 3 (Global select selects every row in that particular page)

You can find two variables currentSelectedRows (to hold the selected items in the current page) and overallSelectedRows (to hold all the selected items) in the Lightning Component.

For now, the data is fetched from the helper using setData method, however, apex call can also be initiated to fetch the records dynamically.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s