0

This question already has an answer here:

I need get the calculate values in childComponent for count this values and show in the page. ChildComponent calculate 2 values (import and ADR) ​​using the parameters that are sent and the input value "contPorcent".

Parent component

<aura:iteration items="{!v.familys}" var="item" indexVar="index">
<c:TCK_Opp_Contingencia_Rows family="{!item}" ContingMax="{!v.ContingMax}" rowIndex="{!index}"/>
</aura:iteration>

Child component

<aura:attribute name="family" type="String"/>
<aura:attribute name="rowIndex" type="String"/>
<aura:attribute name="import" type="Decimal"/>
<aura:attribute name="contPorcent" type="Decimal"/>
<aura:attribute name="ADR" type="Decimal"/>
<aura:attribute name="ContingMax" type="Decimal"/>

<aura:registerEvent name="ChangeContingRowEvt" type="c:TCK_ChangeContingRowEvt"/> 

<tr class="slds-text-title_caps">
    <td>
        <ui:inputText class="slds-input" value="{!v.family}" disabled="true"/>
    </td>
    <td>
        <ui:inputCurrency class="slds-input" value="{!v.import}" disabled="true"/>
    </td>
    <td>
        <ui:inputNumber class="slds-input" value="{!v.contPorcent}" change="{!c.changeValue}" format="##%"/>
    </td>
    <td>
        <ui:inputCurrency class="slds-input" value="{!v.ADR}" disabled="true"/>
    </td>
</tr>

I need show in parentComponent the sum of import and ADR. How can access to this calculate values??

Thanks

marked as duplicate by glls, Dave Humm, battery.cord, David Reed, Pranay Jaiswal Feb 6 at 18:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The attributes from the "parent" don't match the "children." Can you please include all the relevant code? – sfdcfox Feb 6 at 15:15
  • 2
    You can use Component Events to pass values from child to parent. – Jayant Das Feb 6 at 15:16
  • I edited the code. All code of parent and js are very long. I use component event for save and return datas, but here, I need get all calculate values, and recalculate if this values are changed (if user input a new values) – Juan Manuel Garcia Feb 6 at 15:31