I have an attribute in lightning component and it has a value like this:
<aura:attribute name="samListObj" type="Object"/>
[{"created":"","description":"","docId":"","docType":"Claims Documents","docTypeList":[],"fileName":""},
{"created":"","description":"","docId":"","docType":"Client Identification Documents","docTypeList":[],"fileName":""},
{"created":"","description":"","docId":"","docType":"Execution Only","docTypeList":[],"fileName":""},
{"created":"","description":"","docId":"","docType":"Invoice","docTypeList":[],"fileName":""},
{"created":"","description":"","docId":"","docType":"Ongoing Advice Agreements","docTypeList":[],"fileName":""}]
Now I am passing the value into my Apex Class Controller from my lightning controller, like this:
var action = component.get('c.controllerMethod');
action.setParams({
'samValue':component.get('v.samListObj')
});
action.setCallBack(this,function(result){
if(result.getState()){
console.log('SUCCESS');
}
});
$A.enqueueAction(action);
Now in Apex code I have a wrapper class with the same field from my attribute like this:
public class DocumentWrapper {
@AuraEnabled
public String docId = '';
@AuraEnabled
public String docType = '';
@AuraEnabled
public String fileName = '';
@AuraEnabled
public String created = '';
@AuraEnabled
public String description = '';
@AuraEnabled
public List<String> docTypeList = new List<String>();
}
So for my method that calls to my lightning js controller:
@AuraEnabled
public static void updateAPDesciptionCFCheck(List<DocumentWrapper> samValue){
System.debug(samValue);
}
Now I tried to debug the value from my lightning component but it returns empty in every fields:
DocumentWrapper:[created=, description=, docId=, docType=, docTypeList=(), fileName=],
DocumentWrapper:[created=, description=, docId=, docType=, docTypeList=(), fileName=],
DocumentWrapper:[created=, description=, docId=, docType=, docTypeList=(), fileName=],
DocumentWrapper:[created=, description=, docId=, docType=, docTypeList=(), fileName=],
DocumentWrapper:[created=, description=, docId=, docType=, docTypeList=(), fileName=]
For the docType field it should have a value base from the value of the attribute in my component. But I couldn't pull the data.
Any help please?
NOTE: I updated the actual display in my debug log.