You need to sign in to do that
Don't have an account?
Karthik j
Map.set is not working in js LWC
Hi Everyone
I am getting result as returned data from the apex method in js.
here result is the array of objects, I am iterating result over a for loop and trying to add a single object as a value and string as a key to the map ExistingRuleDataMap. but in the logs ExistingRuleDataMap is printing as empty. what I am missing here please help me.
Here is my JS code.
getExistingFilterData({
clusterName: singleCluster
})
.then(result=>{
console.log('RESULT>>'+JSON.stringify(result));
for(let data of result){
console.log('DATA>>'+JSON.stringify(data));
this.ExistingRuleDataMap.set(data.Cluster__c,data);
}
console.log('EXISTING COLLECTION RULE DATA MAP>>'+JSON.stringify(this.ExistingRuleDataMap));
})
.catch(error=>{
console.log('ERROR>>'+error);
})
Thanks in advanse
I am getting result as returned data from the apex method in js.
here result is the array of objects, I am iterating result over a for loop and trying to add a single object as a value and string as a key to the map ExistingRuleDataMap. but in the logs ExistingRuleDataMap is printing as empty. what I am missing here please help me.
Here is my JS code.
getExistingFilterData({
clusterName: singleCluster
})
.then(result=>{
console.log('RESULT>>'+JSON.stringify(result));
for(let data of result){
console.log('DATA>>'+JSON.stringify(data));
this.ExistingRuleDataMap.set(data.Cluster__c,data);
}
console.log('EXISTING COLLECTION RULE DATA MAP>>'+JSON.stringify(this.ExistingRuleDataMap));
})
.catch(error=>{
console.log('ERROR>>'+error);
})
Thanks in advanse
First point are you make sure you getting ressult in console.log('DATA>>'+JSON.stringify(data));
Please use below line :-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh