I have a data table. Each row of the table has a commandButton
called 'Remove', which is supposed to remove that row from the model and the view and perform an update in-place. As a footer, I have another commandButton
called 'Remove every row'.
The last button works. I click on it, every row is removed from the model (i.e the ArrayList
containing the elements becomes empty) and the dataTable
and footer facet
is re-rendered (or updated) in the view.
On the other hand, when I click a button on one of the rows, to remove it, it partially works. The corresponding element is removed from the model but the view is not updated. That row is still there in the dataTable
and the footer facet
hasn't changed.
I have the following piece of code in my users.xhtml
.
<f:metadata>
<f:viewParam name="id" value="#{users.id}" />
<f:event type="preRenderView" listener="#{users.init}" />
</f:metadata>
...
<h:form id="usersForm">
<p:outputPanel>
<p:dataTable id="userTable" value="#{users.user.friendList}" var="friend">
<p:column>
<h:outputText value="#{friend.name}" />
</p:column>
<p:column>
<p:commandButton action="#{users.user.removeFriend(friend)}"
ajax="true"
update="userTable somethingElse" process="@this"
onerror="errorDialog.show();"
icon="ui-icon-delete"
title="delete user">
</p:commandButton>
</p:column>
<f:facet id="somethingElse" name="footer">
aye: ${users.user.xxx}
</f:facet>
</p:dataTable>
</p:outputPanel>
<p:commandButton action="#{users.user.removeAllFriends()}" ajax="true"
update="userTable somethingElse"
process="@this"
icon="ui-icon-close"
value="delete all friends?">
</p:commandButton>
</h:form>
So, what do you think is the problem here?
I'm using JSF 2.0 and Primefaces 3.0