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
Scott H.Scott H. 

lightning:datatable custom row selection


Is there a way to enable row selection when a user clicks on the row of datatable, rather than just on the checkbox/radio button?

I'd imagine I could do this through a combonation of jquery and using the selectedRows object that is provided.

However I'd like to avoid that in favor of a method that would use just the default functionality of the datatable, I'm just not sure how to do that if its currently possible.

Sunil MadanaSunil Madana
Hi Scott,
There is already an event available with lightning:datatable to do this.

Example below:
            columns="{! v.mycolumns }"
            data="{! v.mydata }"
            onrowaction="{! c.handleRowAction }"/>
Hope the above answer helps and please mark as correct answer so others can benefit from it.