I am trying to push data in the controller variable to eventually push it onto the component attribute variable. As of the now the record gets pushed but it clears the previous record that was in there. Please advise!
Here is variable declaration in the component:
<aura:attribute name="closedWons" type="Opportunity[]"/>
Table with iteration:
<tbody>
<aura:iteration items="{!v.closedWons}" var="cw">
<tr style="color:#163e85">
<td>
<div class="slds-text-heading_x-small slds-align_absolute-center">{! cw.Name }</div>
</td>
<td>
<div class="slds-text-heading_x-small slds-align_absolute-center">{! cw.sumchans__Owner_Name__c }</div>
</td>
<td>
<div class="slds-text-heading_x-small slds-align_absolute-center">{! cw.sumchans__Owner_Manager__c }</div>
</td>
</tr>
</aura:iteration>
</tbody>
Variable declaration in the controller:
var oppsToClosedWons = [];
oppsToClosedWons.unshift(oppData);
component.set("v.closedWons", oppsToClosedWons);