[SalesForce] LWC Datatable any possible way to remove ‘select all’ checkbox

So the datatable does ALMOST everything I need for my component, very handy. But I only want one selection of a row at a time. I want users to have to actually click each row if they want to select a row, not be able to do a select all.

If it cannot be hidden at all while keeping the other checkboxes, than I would have no choice but to do a custom table, which is painful to do when the LWC datatable is so close to being just what I need.

Best Answer

This is not possible as a standard. However you can create custom lightning web component with checkbox. You can refer to How to use custom LWC lightning component in lightning-datatable for detailed explanation on how to use custom LWC component in a column. With this solution you will not get select all checkbox.

Custom component HTML:

<template>
    <lightning-input type="checkbox" label="Select" variant="label-hidden" name="input1"></lightning-input>
</template>

This is a very minor work-around compared to building datatable from scratch