I have a list inside other list and I need to modify the values of parameters in both lists. So, I used a "dataTable" inside a "ui:repeat". The only thing that doesn't work is when I try to select a row of the dataTable, the problem is that only the last item is selected.
I verified that the clientId's are the same for all the tables created inside the ui:repeat.
Some of the code:
Code: Select all
<h:form id="contratos">
<ui:repeat value="#{myMB.list1}" var="con">
<p:panel header="Contrato: #{con.descricao}" toggleable="true" toggleSpeed="130" collapsed="true">
<h:panelGrid columns="2" columnClasses="column" cellpadding="5">
<h:outputText value="Contrato"/>
<p:inputText value="#{con.descricao}"/>
</h:panelGrid>
<p:dataTable value="#{con.list}" var="ip" style="width: 450px;">
<p:column headerText="Status">
<h:outputText value="#{ip.status}" />
</p:column>
<p:column headerText="Opções" style="width: 65px;">
<p:commandButton onclick="alterarIp.show()" update="formAlterarIp" title="Alterar IP" image="ui-icon ui-icon-search">
<f:setPropertyActionListener value="#{ip}" target="#{myMB.selectedItem}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:panel>
</ui:repeat>
</h:form>
<p:dialog widgetVar="alterarIp" header="Alterar IP" width="350" modal="true" appendToBody="true">
<h:form id="formAlterarIp">
<h:panelGrid columns="2">
<h:outputText value="IP: " />
<p:inputText value="#{myMB.selectedItem.IP}"/>
<p:commandButton value="Alterar" update="contratos messages" oncomplete="alterarIp.hide()" action="#{myMB.ipAlterar}"/>
</h:form>
</p:dialog>
Thank you!
Edit: I'm using Glassfish v3, Mojarra 2.0.2 and Primefaces 2.2.1