-1

[I have data of having a Boolean field. i want to show that in lightning-datatable as a Check box instead of Utility:check. like show in Image.2

I have data of having a Boolean field. i want to show that in lightning-datatable as a Check box instead of Utility:check. like show in Image

4
  • 1
    Not sure I understand your requirement "instead of Utility:check". Have you tried the type: 'boolean' of the lightning-datatable and you are not happy with it? Commented Nov 2, 2023 at 13:55
  • i tried but by default it showing "Utility:check". i want it as Check box as how in image. Commented Nov 2, 2023 at 13:58
  • 1
    Please add the code that you currently use to your question. Commented Nov 2, 2023 at 13:59
  • Do you mean, you want the checkbox to be checked if the Boolean is true? and uncheck if the boolean is false? When you fetch the data?
    – prem22
    Commented Nov 2, 2023 at 15:09

1 Answer 1

0

This is not possible with the standard data table component. If you use a boolean type, it will show just the icon. The actual checkbox is only available at the left side, row-level, for selecting a row in the table.

Here's a screenshot of the corner of a data table component with the first column having the boolean type assigned to it:

checkbox in table example

Particularly I don't see the absolute need for changing this. If you do, however, need to use an actual checkbox, then you might need to find or build yourself a custom data table component.

Some good reasons not to pursue what you are trying to do include the difficulty of building a custom data table component, the need to maintain third-party code on your org if you do find an open source solution for that, spending money on a paid solution (if it exists) and finally: this goes against the design guidelines that Salesforce itself promotes in its design system.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .