1

I have an assignment to update a checkbox on multiple records on a lightning web component datatable. I found several examples where each record has to be clicked to edit(pencil),edit,update(save). So If i needed to update 5 records I would need 15 clicks In my requirement there should be as less clicks as possble over the rows.

Is there a functionality(set whole table in edit mode) that for example with 5 record I only click once to update all the records, click the corresponding checkboxes once and then click save to update all records. So at the most 7 clicks

If possible it would be nice to have an example or direction to this functionality.

If not possible I assume I would have to gather all the clicks first like in a listview and pass them to a controller, which would be ugly since your not clicking the checkbox itself.

Thanks in advance

1 Answer 1

2

I've worked on a solution for this. Please take a look at https://github.com/albarivas/datatable-editable-checkbox.

Basically:

  • I created a custom type for the checkbox column
  • I used lightning-record-edit-form in the custom type to update the field each time that the checkbox changes

Note that the running user must have visibility of the field (I had to give me permissions to edit the DoNotCall field I've used for the example).

Hope that helps.

1
  • Thanks this was exactly what I was looking for 10 Points!
    – Thomas
    Commented Nov 12, 2021 at 16:14

You must log in to answer this question.

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