5

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.

2

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

| improve this answer | |
  • Oh nice, extending the datatable with custom component should be just what I need. Thank you – Tyler Dahle Oct 1 '19 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.