You need to sign in to do that
Don't have an account?
Ramana123
How to pass map from lightening Component to apex Controller.
Controller
var dataMap = component.get("v.values");
// console.log(accountId) ;
var accountList = [];
for ( var key in dataMap ) {
accountList.push({key: key, value:dataMap[key]});
}
console.log(accountList) ;
var action = component.get("c.updateSortOrder");
// console.log(accountList) ;
action.setParams({
"updateTasksMap":accountList
});
AuraEnabled
Public static void updateSortOrder(Map<string, List<Task__c>> updateTasksMap){
System.debug(updateTasksMap.keyset()) ;
var dataMap = component.get("v.values");
// console.log(accountId) ;
var accountList = [];
for ( var key in dataMap ) {
accountList.push({key: key, value:dataMap[key]});
}
console.log(accountList) ;
var action = component.get("c.updateSortOrder");
// console.log(accountList) ;
action.setParams({
"updateTasksMap":accountList
});
AuraEnabled
Public static void updateSortOrder(Map<string, List<Task__c>> updateTasksMap){
System.debug(updateTasksMap.keyset()) ;
You can go through below link. both have similar situation as of yours
https://stackoverflow.com/questions/41876959/how-to-send-javascript-map-as-a-parameter-from-lightning-component-to-apex-serve
https://salesforce.stackexchange.com/questions/157732/how-to-send-javascript-map-as-a-parameter-from-lightning-component-to-apex-serve
Hope it helps, Please mark it best answer so that other facing similar issue find it useful.
Thanks!
hi,
you can take references from the below code.