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
smita bhargavasmita bhargava 

select All checkbox in datatable

I am having a lightning component datatable with 2 rows each row having a check box.
when I select a checkbox at headlevel then it shud select all rows and when I deselect header level checkbox it will deselect all below chekcboxex. I have atatched a screen for the same.

lightning datatable with select all checkbox

I saw couple of posts but I am not clear on how to proceed.
a working piece of code will be really helpful to understand.

                                 keyField = "id"
                                 tableColumns="{!v.columns}"                                                                  hideCheckboxColumn="false"

Suraj Tripathi 47Suraj Tripathi 47
Hi Smita,

This kind of functionality in the data table, you can implement from this reference

Please mark it as the best answer if it helps you to fix the issue.
Thank you!
Suraj Tripathi