2

Description:

Lightning datatable component allows to place checkboxes within the rows. Checkbox column on top contains a select all checkbox by default.

enter image description here

Question:

Would it be possible to put a label (link/unlink) instead of the 'select all' checkbox in the header column like it's shown in the figure?

1 Answer 1

4

You can't modify the behavior of the select row column.

Recommended Action

Specify an action button in the upper-right area (where "Close" is in your images) with a button to link/unlink, and use the selection column to allow the user to select which rows are affected by the action. This is the preferred, default mode to Lightning, and will prevent a consistent user interface compared to the rest of Lightning.

Original Design

If you insist on sticking with your original design, you're going to have to write your own Lightning Data Table. There's no way to present a checkbox column at this point in lightning:datatable, nor can you alter the behavior of the checkbox column other than to hide/show it.

Even after all that, I would still advise against using a label like "Link/Unlink", as it's not an intuitive UX. Does checked mean it's linked? Unlinked? Going to be toggled from one to the other? Choose one word, either Linked or Unlinked, and make the behavior match the label; if it's Link and a row is checked, the record is Linked, and if the label is Unlink and a row is checked, it is Unlinked.

1
  • Thanks sfdcfox! Well we kept the checkbox header as it is, gave the user a tip that checked is linked and placed a 'save' button next to close to keep it consistent.
    – ACP
    Commented Apr 26, 2018 at 8:26

You must log in to answer this question.

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