I'm trying to make a datatable; each row has a command button to delete it.
When you press the button, the row gets deleted, but the table DOES NOT
update.
But, if you put a buton outside the <p:dataTable> structure, the ajax
updating works fine.
I wrote this simple application to isolate the problem:
Facelet:
Code: Select all
<h:body>
<h:form>
<p:dataTable id="table"
value="#{animalBean.animalList}"
var="currentAnimal"
rowIndexVar="currentIndex">
<f:facet name="header">Animals</f:facet>
<p:column>
<f:facet name="header">Animal index</f:facet>
<h:outputText value="#{currentIndex}"/>
</p:column>
<p:column>
<f:facet name="header">Animal name</f:facet>
<h:outputText value="#{currentAnimal}"/>
</p:column>
<p:column>
<f:facet name="header">Remove buttons</f:facet>
<p:commandButton value="Remove"
update="table"
actionListener="#{animalBean.deleteAnimal}">
<f:param name="deleteIndex" value="#{currentIndex}"/>
</p:commandButton>
</p:column>
<f:facet name="footer"/>
</p:dataTable>
<br/>
<p:commandButton value="Remove First Animal"
update="table"
actionListener="#{animalBean.deleteAnimal}">
<f:param name="deleteIndex" value="0"/>
</p:commandButton>
</h:form>
</h:body>
you press the row's delete button, it deletes but not updates.
What am I missing?
Thank you very much.
Estéban.
JEE5, JSF2.0, GlassFish3, PrimeFaces 2.2.