I am getting error on this line this.contactObj[row] = finall . My method is calling on cellchange event in table and I am using childobject data in table but when I am updating cell value in childObject I am getting error. Could anyone tell me is there any syntax error.
export default class EOperation extends LightningElement {
data = [];
columns = columns;
step = '1';
@api recordId;
boolvalue = true;
emaildata = '';
subject = '';
body = '';
hasError = false;
error;
contactObj = [];
fldsItemValues = [];
temp = [];
secondContact
handleSave(event) {
console.log('draft valus ID ' + JSON.stringify(event.detail.draftValues));
console.log(' type are ' + typeof(event.detail.draftValues) + ' IS Array ' + Array.isArray(event.detail.draftValues));
this.temp.push(event.detail.draftValues);
console.log('Temp 0 ' + JSON.stringify(this.temp['id']))
let row = JSON.stringify(event.detail.draftValues).split(',')[1];
row = row.substring(row.indexOf('-') + 1, row.indexOf('}') - 1)
console.log('row is ' + row)
let field = JSON.stringify(event.detail.draftValues).split(',')[0] + '}';
console.log('ffffis ' + field)
let fieldValue = field.substring(field.indexOf(':') + 2, field.indexOf('}') - 1);
console.log('fieldvalue is ' + fieldValue)
let queryString = '' + field.substring(field.indexOf('{') + 1, field.indexOf('}')) + '';
console.log('queryString ' + typeof(queryString))
field = field.substring(field.indexOf('"') + 1, field.indexOf(':') - 1);
console.log('field is sss ' + field)
let val = this.contactObj[row][field]
let rs = `"${field}":"${val}"`
console.log('rs is ' + typeof(rs))
console.log(' IS Array ' + Array.isArray(this.contactObj))
//let ts1 = this.contactObj.splice(row,1)
console.log(JSON.stringify(this.contactObj[row]).replace(rs, queryString))
console.log('tss is ')
let finall = JSON.parse(JSON.stringify(this.secondContact[row]).replace(rs, queryString));
// this.contactObj[row] =JSON.parse(JSON.stringify(this.contactObj[row]).replace(rs,queryString))
console.log(typeof(finall) + ' >>colomn are ' + typeof(this.secondContact[row]))
console.log('onl;lly ' + this.contactObj[row])
this.contactObj[row] = finall //getting error on this line
//this.secondContact[row]= '[{"Id":"0035j00000MM49HAAT","FirstName":"Alok","LastName":"Thirdss","Phone":"44564754654","Email":"[email protected]"}]'
// console.log(ts.replace(rs,queryString))
//console.log(this.contactObj[row])
//console.log(this.contactObj[row][field])
// let temp2 =
// this.contactObj[row][field] = fieldValue;
}
}