Reputation: 4088
My question is very similar to this: Ajax update doesn't work, when using filter on datatable (JSF, Primefaces).
I have a dataTable
with an "Open" button (a commandButton
) for each entry/row in the table, on click of which, a dialog
will open. I have a form in the dialog that I can update and save. Once I save my changes, I will get back on the dataTable
closing the dialog I'm in, updating the results of the save that happened in the dialog on the entry in the table (whose "Open" was clicked to open the dialog
).
If I save the results from the dialog
and use the update
attribute to update the results of the save on the table entry, it works fine. However, if the dataTable
was filtered in the first place and then the dialog
was opened, then the update
does not result in update of the table entry until I actually refresh/reload the page.
The
oncomplete="PF(':parentForm:dataTableVar').filter()"
and
oncomplete="PF(':parentForm:dataTableVar').clearFilters()"
solutions recommended in the other question I referenced don't seem to have any effect in my case.
Any suggestions?
I use JSF v2.1.19 and PrimeFaces v5.1.
Upvotes: 1
Views: 2088
Reputation: 4088
It was my mistake to mention the id
in place of the widgetVar
. This:
oncomplete="PF('myTableWidget').filter()"
would work fine if the dataTable
in question looks like:
<p:dataTable id="myTable" widgetVar="myTableWidget"...
I was wrongly trying it this way:
oncomplete="PF('myTable').filter()"
Upvotes: 1
Reputation: 4783
You need to mark the list in the attribute filteredValue
on dataTable.
Ex: <p:dataTable filteredValue="#{bean.anotherListWithTheSameType}" />
In dialog, it's necessary filteredValue. From here: http://www.primefaces.org/docs/vdl/4.0/primefaces-p/dataTable.html
Upvotes: 2