How to fully reinialize a dataTable based on multiViewState?

UI Components for JSF
Post Reply
DazzlingBob
Posts: 11
Joined: 07 Mar 2019, 15:20

11 Oct 2021, 00:21

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.

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

16 Oct 2021, 13:34

We do exactly what you do above in our projects and it works. It removes all sorting and filtering.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests