+ Start a Discussion
Marco SchmitMarco Schmit 

ui:input not updating when used within aura:iteration

Hi,

I just ran into an issue using ui:textInput within aura:iteration
 
<aura:attribute name="test" type="String[]" default="test1, test2"></aura:attribute>

<aura:iteration items="{!v.test}" var="t">
      {!t}
      <ui:inputText value="{!t}"></ui:inputText>
</aura:iteration>

so when I type something in the input box and leave it, the output should change too, shouldnt it?
Any help?
Thanks!
 
Ankit Gupta@ DeveloperAnkit Gupta@ Developer
Hi Marco,

I think you will have to assign Aura id and on particular event you have to update component attribute with values of input box.



 
Dmitry Golofaev 9Dmitry Golofaev 9
Need to use updateOn="some event" attribute for 'ui:inputText'
For example: <ui:inputText value="{!item.value}" updateOn="keyup" />
Antoine LELEU 10Antoine LELEU 10
Hi Marco,

I have the same issue.
Have you find a solution to this problem ?

Thanks for your help.
Antoine
Lourdes Montero CamposLourdes Montero Campos
Hi! I had the same issue. The problem with this is that the list of strings is passed by value. Instead of displaying a list of strings, use a list of js Objects, that have a string field..
Example:
 
<aura:iteration items="{!v.ObjectList}" var="currObj" indexVar="i">
			<ui:inputText value="{!currObj.Name}" /> 
	</aura:iteration>

doing this worked for me. I hope it helps ;)