Page 1 of 1

How to fully reinialize a dataTable based on multiViewState?

Posted: 11 Oct 2021, 00:21
by DazzlingBob
In a project we have been using the dataTable component (non lazy) for CRUD with filtering/sorting and multiViewState.
Some how after a series of manipulation actions the visually representation of the dataTable sort/filter will get messed up.
A full page refresh (non ajax) seems to fix the issue (multiViewState is restored). Working on a fully-reproducible example.

As a workaround i am trying to fully reinialize the table sort/filter/cache/... instance state based on the stored multiViewState state.

Something like:

Code: Select all

DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent("form:datatable");
dataTable.reset();
...
Has someone dealt with this before?
Using primefaces 10.0.7 (latest version) and mojarra23.

Re: How to fully reinialize a dataTable based on multiViewState?

Posted: 16 Oct 2021, 13:34
by Melloware
We do exactly what you do above in our projects and it works. It removes all sorting and filtering.