I try to store the settings of a lazy primefaces datatable into a session (we are view scoped and cannot change this). The idea is to follow links and
on return the settings should be restored as before when the page has been left.
I use a PhaseListener to get the Datatable settings and store them into the session and restore them by binding a Bean to the datatable.
PhaseListener:
Code: Select all
@Override
public void beforePhase(final PhaseEvent event) {
FacesContext context = event.getFacesContext();
UIViewRoot viewRoot = context.getViewRoot();
DataTable dataTable = findDataTableInComponent(viewRoot);
if (dataTable != null) {
// store properties in session with viewRoot as key
}
}
@Override
public PhaseId getPhaseId() {
return PhaseId.RENDER_RESPONSE;
}
Code: Select all
public DataTable getDataTable() {
return this.dataTable;
}
public void setDataTable(final DataTable dataTable) {
// get properties for current viewId from session ...
if (dataTable != null) {
dataTable.setPage(...);
dataTable.setFirst(...);
dataTable.setFilters(...);
}
dataTable.setLazy(true);
}
this.dataTable = dataTable;
}
The column headers do therefore not reflect the stored changes.
So here comes the question:
How do I request an update of filter column headers?
I may use
Code: Select all
jQuery(document).ready( function() {}
Or is it possible to trigger the header replacement from the server side?
We may unfortunately not update to 3.x Primefaces.