You need to sign in to do that
Don't have an account?
d.tejdeep@nicomatic.in
I want to pass MAP value
"RowIndex":[component.get("v.rowIndex"),component.get("v.BatchList")]
How can i do that ?
How to pass map value via action to apex controller from lightning component ?
action.setParams({ "Bt": component.get("v.BatchList"), "QliRowNum": 1, "RowIndex":[component.get("v.rowIndex"),component.get("v.BatchList")] }); action.setCallback(this,function(resp){lightning APEX:
@AuraEnabled public static list<batch__c> SaveBatchDet(integer QliRowNum,list<Batch__c> Bt,map<string,list<batch__c>> RowIndex){
I want to pass MAP value
"RowIndex":[component.get("v.rowIndex"),component.get("v.BatchList")]
How can i do that ?
https://salesforce.stackexchange.com/questions/157732/how-to-send-javascript-map-as-a-parameter-from-lightning-component-to-apex-serve
<aura:component controller="Your_Controller">
<aura:attribute name="theMap" type="Map" default="{}"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
</aura:component>
Controller code:
({
doInit : function(component, event, helper) {
var action = component.get("c.SaveBatchDet");
var theMap = component.get("v.theMap");
//add some params
theMap["key1"]="test1,test2,test6";
theMap["key2"]="test3,test4,test5";
action.setParams({
"RowIndex": theMap
});
action.setCallback(this, function(result) {} );
$A.enqueueAction(action);
}
})
Apex :
@AuraEnabled
public static list<batch__c> SaveBatchDet(map<string,list<batch__c>> RowIndex){
system.debug('RowIndex'+RowIndex);
}
Hi d.tejdeep@nicomatic.in
If you want to pass the map from helper to apex then you have to create a map attribute and you have to store all values in the map and you have passed in the Setparms in action. And In the apex method, you have passed a variable that must be Map type.
If you resolved your bug. Please mark my Best answer.
Thanks
Suraj Tripathi