I am having fits with lightning aura iteration, it doesn't do anything just puts in a blank row, no errors .Having zero luck here is my lightning component
Component:
<table class="slds-table slds-table--bordered slds-table--cell-buffer">
<tr class="slds-text-title--caps">
<th scope ="col">
<div class="slds-truncate" title="Cart">Cart</div>
</th>
<th scope="col">
<div class="slds-truncate" title="QT">QT</div>
</th>
<th scope="col">
<div class="slds-truncate" title=""></div>
</th>
</tr>
<tbody>
<aura:iteration items="{!v.orderItemList}" var="ct">
<tr>
<th scope="row" data-label="Cart">
<div class="slds-truncate" title="{!ct.Description__c}">{!ct.Description__c }</div>
</th>
<td data-label="QTY">
<div class="slds-truncate" title="{!ct.Quantity__c}">{!ct.Quantity__c}</div>
</td>
<td data-label="">
<div class="slds-truncate" title="{!ct.Price__c}">{!ct.Price__c}</div>
</td>
</tr>
</aura:iteration>
</tbody>
</table>
Here is the JS:
({
doInit : function(component, event, helper) {
var action = component.get("c.getOrder");
action.setParams({
"recordId":component.get("v.recordId")
//"recordId":"8010K0000026d6Y"
});
action.setCallback(this,function(response){
var state = response.getState();
if(state === "SUCCESS"){
component.set("v.order",response.getReturnValue());
console.log(response.getReturnValue());
}
});
$A.enqueueAction(action);
},
sendE : function(component, event, helper) {
var email = component.get("v.order.Email__c");
var subject = component.get("v.order.Subject__c");
var action2 = component.get("c.sendEmail");
var getallitems = component.get("c.orderItem")['ct'];
var ItemList =[];
for (var key in getallitems){
ItemList.push(key+ '=' +getallitems[key]);
}
component.set("v.ItemList", orderItemList);
console.log(orderItemList);
action2.setParams({
"email":email,
"rId":component.get("v.recordId"),
"subject":subject
});
action2.setCallback(this,function(res){
var state = res.getState();
if(state === "SUCCESS"){
alert("win");
//component.set("v.order",response.getReturnValue());
console.log(res.getReturnValue());
}
else{
console.log("failed");
}
});
$A.enqueueAction(action2);
}
})
Controller:
public static Line__c orderItem {get;set;}
@AuraEnabled
public static Line__c getOrderLines(string recordId) {
orderItem = [select Id,Quantity__c,Price__c,Price__c,
Description__c,Order__r.Total__c
from Line__c where Order__c=:recordId];
system.debug('Order rows'+orderItem);
return orderItem;
}