• Jack Andrew
  • NEWBIE
  • 10 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am new to LWC and trying to fetch the records in the Lightning Datatable, which is working fine. After that i am trying to insert a record into the same using the record edit form and using refreshApex to display the inserted record immediately.
Can someone help me with the same?
PFA the code snippet for the same
@wire (getAccData,{recordId: '$recordId'})
    getAccTable({data, error}){
        if(data){   
            this.tableData = data;
        }
        else{
            console.log(error);
        }
    }

Here, i am storing the data returned from apex in tableData and then calling the same table data in refreshApex. But it's not working.

handleSave(){
        insertAcc({name : this.name})
        .then((result) => {
          this.result = result;
          return refreshApex(this.tableData);
        })
        .catch((error) => {
          this.error = error;
        });
    }