0

I am using lightning datatable where there are two actions EDIT and DELETE. When I choose the EDIT option I am opening the standard edit navigation as follows.

<lightning-datatable 
     class="slds-max-medium-table_stacked"
     key-field="Id" 
     data={records.records}
     columns={records.columns}
     onrowaction={handleRowAction}
     hide-checkbox-column=true
     show-row-number-column=false>
</lightning-datatable>

on handleRowAction I am calling following for EDIT

handleRowAction(event) {
    this.actionName = event.detail.action.name.toUpperCase();
    const row = event.detail.row;
    switch (this.actionName) {
        case 'DELETE':
            this.selectedRecord = row;
            this.isDeleteModal = true;
            break;
        case 'EDIT':
            this.navigateToRecordEditPage(event, row.Id);
            break;
        default:
    }

navigateToRecordEditPage(event, recordId) {
    event.preventDefault();
    this[NavigationMixin.Navigate]({
        type: 'standard__recordPage',
        attributes: {
            recordId: recordId,
            objectApiName: this.records.relatedSobjectApiName,
            actionName: 'edit'
        }
    });
}

this opens the standard modal and update the record but same is not reflected on datatable. Is there any way we can capture the save callback/event in LWC.

1 Answer 1

0

Finally I am able to go past this situation. We don't have any OOB LWC events that listen to standard show toast events but I have used a platform event that will get fired on record update/create and we can subscribe to that event in our LWC component and refresh the lightning-datatable once the save is commited and successful. To know more on how to do this please refer to my blog How to Refresh Lightning Datatable after triggering standard events(new/edit) in LWC.

You must log in to answer this question.

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