1

I have a lightning data table with a inline editable field. It working perfect as expected when I do manual edit and save. What I need in addition to the existing behaviour is, I need to edit the value of entire column onButton click. Then It will enable bulk update for the user.

I was researching for this everywhere on the internet and unable to find a solution. If anyone has come through similar situation and has found a solution, I appreciate your contribution.

1

You can render a different datatable with checkboxes displayed attribute depending on a button on the component.

To mass edit your rows, you can use checkboxes. The checkbox at the first low level if clicked, will select all remaining rows.

Attribute I mention is hideCheckboxColumn, here's a sample code to get the selected row below.

    handleClickAdd() {

        var el = this.template.querySelector('lightning-datatable');
        var selected = el.getSelectedRows();
        let selectedIdsArray = [];

        for (const element of selected) {
            //console.log('elementid', element.Id);
            selectedIdsArray.push(element.Id);
        }
  • I can get selected-rows or select rows programmatically. My table already has check-boxes. What I need to do is change cell value on button click. – Isuru Buddhika Herath Oct 30 at 22:18

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.