You need to sign in to do that
Don't have an account?
edoardo_spano
ui:inputNumber lose changes inside aura:iteration
Hi all,
I wrote this lines inside a lightning component:
I tried to remove the aura:iteration and get just the first two elements of the array "v.items", like this:
Can someone help me?
Thanks in advance.
Edoardo
I wrote this lines inside a lightning component:
<aura:iteration items="{!v.items}" var="item"> <tr class="slds-hint-parent"> <th scope="row"> <div class="slds-truncate">{!item.voce.Listino_fornitore__r.Articolo__r.Name}</div> </th> <td>{!item.voce.Listino_fornitore__r.Unita_di_misura__c}</td> <td class="slds-text-align--right"><ui:outputNumber value="{!item.voce.Quantita__c}"/></td> <td class="slds-text-align--right"><ui:outputCurrency value="{!item.voce.Listino_fornitore__r.Prezzo__c}"/></td> <td class="slds-text-align--right"><ui:outputCurrency value="{!item.voce.Listino_fornitore__r.Prezzo_scontato__c}"/></td> <td class="slds-text-align--right"><ui:inputNumber value="{!item.voce.Listino_cliente__r.Ricarico__c}"/></td> <td></td> </tr> </aura:iteration>All appear correctly, but if I try to change the value of the ui:inputNumber, it is automatically override by the old value.
I tried to remove the aura:iteration and get just the first two elements of the array "v.items", like this:
<tr class="slds-hint-parent"> <th scope="row"> <div class="slds-truncate">{!v.items[0].voce.Listino_fornitore__r.Articolo__r.Name}</div> </th> <td>{!v.items[0].voce.Listino_fornitore__r.Unita_di_misura__c}</td> <td class="slds-text-align--right"><ui:outputNumber value="{!v.items[0].voce.Quantita__c}"/></td> <td class="slds-text-align--right"><ui:outputCurrency value="{!v.items[0].voce.Listino_fornitore__r.Prezzo__c}"/></td> <td class="slds-text-align--right"><ui:outputCurrency value="{!v.items[0].voce.Listino_fornitore__r.Prezzo_scontato__c}"/></td> <td class="slds-text-align--right"><ui:inputNumber value="{!v.items[0].voce.Listino_cliente__r.Ricarico__c}"/></td> <td></td> </tr> <tr class="slds-hint-parent"> <th scope="row"> <div class="slds-truncate">{!v.items[1].voce.Listino_fornitore__r.Articolo__r.Name}</div> </th> <td>{!v.items[1].voce.Listino_fornitore__r.Unita_di_misura__c}</td> <td class="slds-text-align--right"><ui:outputNumber value="{!v.items[1].voce.Quantita__c}"/></td> <td class="slds-text-align--right"><ui:outputCurrency value="{!v.items[1].voce.Listino_fornitore__r.Prezzo__c}"/></td> <td class="slds-text-align--right"><ui:outputCurrency value="{!v.items[1].voce.Listino_fornitore__r.Prezzo_scontato__c}"/></td> <td class="slds-text-align--right"><ui:inputNumber value="{!v.items[1].voce.Listino_cliente__r.Ricarico__c}"/></td> <td></td> </tr>In this way all works fine (new values is not override), but I need to maintain the aura:iteration because I don't know how many elements there are in the array.
Can someone help me?
Thanks in advance.
Edoardo