I have a class like this:
global class CustomerStudyFeilds {
public String FeildName{ get; set; }
public String ChooseType{ get; set; }
public double Length{ get; set; }
public boolean IfRequired{ get; set; }
}
And a component:
<aura:iteration items="{!v.feildlists}" var="feild">
<br />
<p>{!feild.FeildName}</p>
</aura:iteration>
And the Apex Controller:(in the controller I can get back the FeildName and so on)
@AuraEnabled
public static List<CustomerStudyFeilds> getAllFeilds(Study__c study) {
String sojname = study.Name + '__c';
List<CustomerStudyFeilds> wulala = MetadataServiceExamples.readCustomObject(sojname);
system.debug('=========================================================');
system.debug(wulala.get(0));
system.debug(wulala.get(0).FeildName); //**here I can get the right name of the feild.**
return wulala;
}
controller.js:(but when it comes to here feildlists[0] don't have the attribute how Can I sovle it?)
doInit: function(component, event, helper) {
console.log("init method");
var action = component.get("c.getAllFeilds");
action.setParams({
"study": component.get("v.study")
});
// Add callback behavior for when response is received
action.setCallback(this, function(response) {
var state = response.getState();
if (component.isValid() && state === "SUCCESS") {
component.set("v.feildlists", response.getReturnValue());
console.log(component.get("v.feildlists")[0].FeildName);//**but here I got nothing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!**
}
else {
console.log("Failed with state: " + state);
}
});
// Send action off to be executed
$A.enqueueAction(action);
}
Can you explain me why? because I can not get the right value in the controller so I can not display it !It is very kind of you ! Thank you very much!