Going straight to the point, i have spent quite some time yesterday figuring out createComponent and now it finally works, but the main reason i wish to use $A.createComponent instead of a iteration is because i found out that you can use a dynamic aura:id with $A.createComponent.
Code snippet from the helper:
$A.createComponent("nvmsconfigtool:pageComponentCard", {
"aura:id": "cardId",
"component": results[i],
"class": "slds-size--1-of-1 slds-medium-size--1-of-2 slds-large-size--1-of-3 slds-p-around--small",
},
function(comp, status, errorMessage) {
if (status === "SUCCESS") {
var body = cmp.get("v.body");
body.push(comp);
cmp.set("v.body", body);
} else if (status === "INCOMPLETE") {
console.log("No response from server or client is offline.")
} else if (status === "ERROR") {
console.log("Error: " + errorMessage);
}
}
)
If my research is correct, this code should be working just fine and it does! Its just that it doesn't seem to make the Aura:id, i tried to find it using cmp.find("cardId")