title: PrimeFaces dataTable pagination and javascript
body: <p>I'm using PrimeFaces 6.1 and I'm dealing with a table like this</p>
  
  <pre><code>&lt;p:dataTable 
      id="listingsTable"
      value="#{listingsController.listingsLazyDataModel}" 
      var="actualAd" 
      paginator="true"
      rows="20"
      lazy="true"
      paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
      rowsPerPageTemplate="10,20,30"
      paginatorPosition="bottom"
      widgetVar="listingsTableDesktop"&gt;
  
      &lt;p:ajax event="page" listener="#{listingsController.pageChanged}" oncomplete="pageChangedOnDetails(PF('listingsTableDesktop'))" /&gt;
  
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>and the javascript is the following</p>
  
  <pre><code>function pageChangedOnDetails(listingsTableDesktop) {
      console.log("paginaDestinazione1="+listingsTableDesktop.paginator.getCurrentPage());
      console.log("paginaDestinazione2="+listingsTableDesktop.paginator.currentReport[0].innerText);
  }
  </code></pre>
  
  <p>The problem is that all the two lines of code inside the pageChangedOnDetails function return always the page on which the user was before the page event.</p>
  
  <p>Seems to be the "onComplete" is called before the dom is updated.</p>
  
  <p>Is it the expected behaviour?
  Am I doing something wrong?</p>