I have a custom LWC Page which is used as Public site.
In my Page I have form which will populate the data in Contact
object and display the value in Data table.
I have integrated inline edit in my data table by Using updateRecord
, I'm getting Invalid Privileges.
So i was trying to update the field value by calling Apex Controller.
<lightning-datatable key={stu.Id} key-field="Id" data={stu.spitems} columns={studentProgram}
data-record-id={studentsData.studentId} draft-values={draftValues}
hide-checkbox-column="true"
onsave={handleInlineEdit} show-row-number-column=false>
</lightning-datatable>
handleInlineEdit(event) {
var draftValuesStr = JSON.stringify(event.detail.draftValues);
alert(draftValuesStr);
}
I'm editing the two row's value in the data table, On click save calling the handleInlineEdit
method, draftValuesStr
have JSON value like Below
[
{
"StartDate": "2020-05-10",
"Id": "a022w0000033ckoTFC"
},
{
"StartDate": "2020-05-03",
"Id": "a022w0000033ckpFDC"
}
]
I can pass this draftValuesStr
to APEX controller, my question here is - How we can update the value in each row by Id in APEX. Please help me on this.