Datatable does not update after successful ajax call
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"
.
If you want to use server IDs for updating components (like userTable
, somethingElse
, ...), these components need to be in the same naming container as the component which triggers the update (your button for example). Otherwise you need to use an expression like this within the update attribute: update=":usersForm:userTable"
.
The main problem is to identify the naming containers. The outer button does work, because it is in the same naming container (the form) as the table with the ID userTable
. The facet gets updated because the whole table gets updated, but since datatable is a naming container itself, it should not be possible to update the footer by just using update="somethingElse"
on the outer button.
I'm not sure, why the inner button does not work. I guess there is another naming container within the datatable. PrimeFaces does log an INFO, if the component could not be found using the findComponent algorithm of the UIComponent implementation. INFO: Cannot find component with identifier "userTable" in view.
I had filters in my datatable. So here I resolved the problem with
oncomplete="PF('myWidgetVar').filter()" and update="@form"
You are probably using Primefaces 2.2.1 as this seems like it is due to a common bug with the Primefaces dataTable component. Essentially what occurs is that ajax postbacks occurring from within elements of a dataTable will not result in a partial page update of elements in the dataTable.
The simplest workaround is to invoke a postback from a button outside of the dataTable where its sole purpose is simply to partial page update the dataTable. This is not the most efficient solution as it results in two postbacks, however it does work.
See my previous answer to this problem Here