This is my apex controller:
public class EventsController {
public String JsonMap{get;set;}
public Map<ID, Map<Integer, List<Event_Product__c>>> prod_quantity{get;set;}
public PageReference ManageAttendee(){
//Code ......
system.Debug(prod_quantity);
JsonMap=JSON.serialize(prod_quantity);
}
@RemoteAction
public static ASPHPP__ASPayment_TXN__c getPaymentTXNs(String prod_quantity_2){
system.Debug(prod_quantity_2);
}
}
The data on the prod_quantity
in ManageAttendee
is this:
{a0428000006OyU1AAK={1=(Event_Product__c:{Id=a0428000006OyU1AAK, Name=Event Product-0023, Event_Product_Name__c=Summit General Admission, Price__c=10.00, Minimum_Quantity__c=1, Maximum_Quantity__c=10, Attendee_Custom_Fields__c=Anonymous__c;First_Name__c;Last_Name__c;Email_Address__c})}}
Then I passed to VF page using JsonMap
.
<apex:page sidebar="false" showheader="false" standardStylesheets="false" docType="html-5.0" controller="EventsController">
<script>
window.onload = processPayment;
var prod_quantity_2 = JSON.parse('{!JsonMap}');
function processPayment(){
setTimeout(Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.EventsController.getPaymentTXNs}',
prod_quantity_2,
function(result, event) {
if(result == null){
// Code .....
}else{
// Code .....
}
}), 2000);
}
</script>
</apex:page>
The data of the prod_quantity_2
on the @RemoteAction
is this:
{a0428000006OyU1AAK={1=[{attributes={type=Event_Product__c, url=/services/data/v34.0/sobjects/Event_Product__c/a0428000006OyU1AAK}, Id=a0428000006OyU1AAK, Name=Event Product-0023, Event_Product_Name__c=Summit General Admission, Price__c=10, Minimum_Quantity__c=1, Maximum_Quantity__c=10, Attendee_Custom_Fields__c=Anonymous__c;First_Name__c;Last_Name__c;Email_Address__c}]}}
It is different with the previous data of prod_quantity.. Is there other way to pass a map into a vf page then to the RemoteAction? Or can I access the map directly to the RemoteAction since they are in the same controller?..