• Andrew Porter 33
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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. I know we have option in aura as force:refreshView event, is there anything similar in lightning as well?

Note: I know this is possible if I use lightning-record-edit-form where I have full control on save and submit but I need this working for the standard navigatoin.