You need to sign in to do that
Don't have an account?
Avik Mukherjee 16
When ever i am trying to update a value in the object array i am greeting script error, even splice does not works below are two snippets in lwc js.
let allValues=this.budgetData; // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues) ); for(let i = 0; i < allValues.length; i++){ if(allValues[i].Id === event.target.name ){ // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues[i]) ); allValues.splice(i,1); } }
let allValues=this.budgetData; // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues) ); for(let i = 0; i < allValues.length; i++){ if(allValues[i].Id === event.target.name ){ // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues[i]) ); allValues[i]= objectvalue; } }
I am getting error when ever i am trying to update a object in an object array in LWC
When ever i am trying to update a value in the object array i am greeting script error, even splice does not works below are two snippets in lwc js.
let allValues=this.budgetData; // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues) ); for(let i = 0; i < allValues.length; i++){ if(allValues[i].Id === event.target.name ){ // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues[i]) ); allValues.splice(i,1); } }
let allValues=this.budgetData; // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues) ); for(let i = 0; i < allValues.length; i++){ if(allValues[i].Id === event.target.name ){ // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues[i]) ); allValues[i]= objectvalue; } }
One more interesting specialty of this app.