Ajax update doesn't work, when using filter on p:dataTable Ajax update doesn't work, when using filter on p:dataTable ajax ajax

Ajax update doesn't work, when using filter on p:dataTable


After updating datatable you have to invoke it's client side filter() method.

<p:dataTable widgetVar="dataTableWidgetVar" id="dataTable" var="row"             value="#{bean.value}"             filteredValue="#{bean.filteredValue}"             paginator="true" rows="25" paginatorPosition="bottom"             rowKey="${row.id}"             editable="true"><p:commandButton value="Save"                 actionListener="#{bean.save}"                 update=":form"                 oncomplete="PF('dataTableWidgetVar').filter()"/>

For PrimeFaces versions older than 5, you should use

<p:commandButton value="Save"                 actionListener="#{bean.save}"                 update=":form"                 oncomplete="dataTableWidgetVar.filter()"/>


Adding answer for Primefaces 5.x , since they changed the way for calling widget var:

Almost same as Kerem Baydogan's answer but with a little modification :

<p:commandButton value="Save"                 actionListener="#{bean.save}"                 update="@form"                 oncomplete="PF('dataTableWidgetVar').filter()"/>

Or you can clear filters at all with :

<p:commandButton value="Save"                 actionListener="#{bean.save}"                 update="@form"                 oncomplete="PF('dataTableWidgetVar').clearFilters()"/>


For the version of primefaces greater or equal to 5, you can use this block of code, it works very well

<p:dataTable var="page" value="#{yourBean.allData}" widgetVar="yourWidgetVarName"/><p:commandButton value="delete"                 actionListener="#{yourBean.delete}"                 update="@form"                 oncomplete="PF('yourWidgetVarName').filter()"/>