I have a table in my component which has aura:iteration with rows. Each row has input. I need to summarise these all values. How can I do it?

<aura:iteration items="{!v.listOfRecords}" var="record">
       <td><lightning:input aura:id="input" type="number" value="{!record.Price__c}"/></td>      

1 Answer 1


For this we should just get array of all inputs by component.find() and go through the array and add oncommit event to input

<lightning:input aura:id="input" oncommit="{!c.commit}" type="number" value="{!record.Price__c}"/>

commit: function(component) {
    let pricesSum = 0;
    let changedPrices = component.find("input");

    changedPrices.forEach(element => {
        if (element.get("v.value")) {
            pricesSum += element.get("v.value");

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .