Hey guys,
I found an elegant solution for my case. What I just needed to do, as Cagatay said, first, I need to hook the "first" attribute so that used to bind it on the datatables via backing bean. Allways I come back to the datable my bean points to the exactly "first" value that according to the manual is "indexes the firsr row to be displayed"!
of course, the first row to be displayed also means the begining of the former current pages.
See what I've done:
in the datatable's backingbean I create a property that holds the "fisrt" element previously hoocked:
@ManagedBean
@SessionScoped
public class DataTableController implements java.io.Serializable {
protected int first;
// getters and setters...
My datatables will be like this. I simplified the example so that can more readable!
<p:dataTable id="results-table" var="result"
...
first="#{dataTableController.first}"
...
>
<p:ajax event="page" listener="#{dataTableController.onPageChange}"/>
...
Then I hook the last "first" value from the databales on a PageEvent
public void onPageChange(PageEvent event) {
this.setFirst(((DataTable) event.getSource()).getFirst());
}
I hope this could help future generation of prime uesers!
Obrigado!!