function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
edoardo_spanoedoardo_spano 

ui:inputNumber lose changes inside aura:iteration

Hi all,

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