Murat Derya Özen Murat Derya Özen - 1 year ago 94
Ajax Question

Datatable does not update after successful ajax call

I have a data table. Each row of the table has a

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
called 'Remove every row'.

The last button works. I click on it, every row is removed from the model (i.e the
containing the elements becomes empty) and the
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
and the
footer facet
hasn't changed.

I have the following piece of code in my

<f:viewParam name="id" value="#{}" />
<f:event type="preRenderView" listener="#{users.init}" />


<h:form id="usersForm">
<p:dataTable id="userTable" value="#{users.user.friendList}" var="friend">
<h:outputText value="#{}" />
<p:commandButton action="#{users.user.removeFriend(friend)}"
update="userTable somethingElse" process="@this"
title="delete user">

<f:facet id="somethingElse" name="footer">
aye: ${}


<p:commandButton action="#{users.user.removeAllFriends()}" ajax="true"
update="userTable somethingElse"
value="delete all friends?">


So, what do you think is the problem here?

I'm using JSF 2.0 and Primefaces 3.0

Answer Source

I recognize this problem form one of our current PF 3.0 pages. It will work if you use update="@form" instead. I haven't really had the time to investigate the real cause so that I can report it to the PF guys, because this problem does not manifest in all pages. Even in the same table, a different button works as intented.

Give it a try:

<p:commandButton update="@form" ... />

Update: coming to think about it, it's maybe related to the presence of process="@this".