I have created a class with several fields like this:
public class Tier{
@AuraEnabled
public String Name {get; set;}
@AuraEnabled
public integer Min {get; set;}
@AuraEnabled
public integer Max {get; set;}
@AuraEnabled
public Decimal Amount {get; set;}
@AuraEnabled
public integer cnt {get; set;}
}
This is made in the apex controller and linked to a lightning component.
The lightning component has an attribute wich contains multiple "Tiers" as an array.
<aura:attribute name="tiers" type="StaffelPricingController.tier[]"/>
Than after editing it should be send back to the apex controller class for further processing like this:
changeTiers : function(component){
var tiers = component.get("v.tiers");
var recordId = component.get("v.recordId");
var action = component.get("c.getSave");
action.setParams({
"recordId": recordId,
"tiers": tiers
})
$A.enqueueAction(action);
}
after this I want to have the list of tiers available for editing in apex so I did this:
public static string getSave (list<tier> tiers, string recordId){
//do some stuf here and return a string
}
now the value of tiers is not the correct type for processing, it seems to come in like some sort of JSON string that I can't process with de deserialize options.
Does anyone have any idea how te get a propper list of class back from a lightning component?
any help is appreciated, hints, tips, whatever