vicky
vicky

Reputation: 109

How to update <ui:repeat> data without page reload?

I have a list of user names and the list of user name increases based on the number of inputs given by the user.The thing is as the user inpputs the user name the list gets populated with the inputs and my gets updated only when my page reloads. Here is the code that i have tried so far.

 <ui:repeat id="update" value="#{data.value}" var="tes">

 #{tes.name}
 </ui:repeat>

 <h:inputText value=#{data.name}/>
 <p:commandButton actionListener="#{data.addname()}" update="update"/>

I am unable to update my data with out page reload please suggest me how to update ui:repeat data with out page reload. Thanks in advance.

Upvotes: 1

Views: 2104

Answers (1)

Mr.J4mes
Mr.J4mes

Reputation: 9266

Try this:

<h:form>
    <h:panelGroup id="toUpdate">
        <ui:repeat value="#{data.value}" var="tes" >
            #{tes.name}
        </ui:repeat>
    </h:panelGroup>

    <h:inputText value=#{data.name}/>
    <p:commandButton actionListener="#{data.addname()}" update="toUpdate"/>
</h:form>

Upvotes: 2

Related Questions