You need to sign in to do that
Don't have an account?
NLT
Error on inline edit for the list of records in lightning web component
Hi All, When i try to do inline edit for the list of records in LWC component as shown in the below screenshot, It reload the pop up window again instead of allowing me to submit as shown in 2nd screenshot. Below is code for handleSave function, please correct if anything is wrong.
//Enable Inline Editing for Multiple Rows
handleSave(event) {
const recordInputs = event.detail.draftValues.slice().map(draft => {
const fields = Object.assign({}, draft);
return { fields };
});
const promises = recordInputs.map(recordInput => updateRecord(recordInput));
Promise.all(promises).then(OpportunityLineItems => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Success',
message: 'Products updated',
variant: 'success'
})
);
// Clear all draft values
this.draftValues = [];
// Display fresh data in the datatable
return refreshApex(this.OpportunityLineItem);
}).catch(error => {
// Handle error
});
}
Thanks.
//Enable Inline Editing for Multiple Rows
handleSave(event) {
const recordInputs = event.detail.draftValues.slice().map(draft => {
const fields = Object.assign({}, draft);
return { fields };
});
const promises = recordInputs.map(recordInput => updateRecord(recordInput));
Promise.all(promises).then(OpportunityLineItems => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Success',
message: 'Products updated',
variant: 'success'
})
);
// Clear all draft values
this.draftValues = [];
// Display fresh data in the datatable
return refreshApex(this.OpportunityLineItem);
}).catch(error => {
// Handle error
});
}
Thanks.
Please follow below url:-
https://www.w3web.net/record-save-edit-field-inline-in-lwc/
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh