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.

 <c:GPS_COMP_DataTableUtility
                                 keyField = "id"
                                 tableData="{!v.tableData}"
                                 tableColumns="{!v.columns}"                                                                  hideCheckboxColumn="false"
                                 maxRowSelection="{!v.maxRowSelection}"
                                 selectedRows="{!v.selectedRows}"/>

Thanks
smita
Suraj Tripathi 47Suraj Tripathi 47
Hi Smita,
Greetings!

This kind of functionality in the data table, you can implement from this reference
https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/example#lightningcomponentdemo:exampleDatatableBase

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