title: Primefaces datatable custom pagination not updating
body: <p>I am working on an application where we have our older code base (Struts 1) and are now building out a newer code base using JSF to run alongside the rest of the (old) application. The older datatables that we have across our application show the following for pagination:</p>
  
  <p>"Showing 1 to 20 of 50 entries"</p>
  
  <p>I have been tasked with getting the new PF datatable to display the same way.</p>
  
  <p>I was able to get this working for the first page by overriding the <code>encodePaginatorMarkup</code> method of the primefaces <code>DataRenderer</code> class. The problem comes when the page is changed - this method is not being called to update the pagination. This is confusing to me because the current page (and everything else) gets updated in the normal pagination template without this method getting called.</p>
  
  <p>I looked at the AJAX response being sent back when changing pages and don't see any HTML generated for updating the pagination (only the total count). This leads me to believe that everything is being handled in JS.</p>
  
  <p>The way I'm currently thinking of implementing it would be to use an <code>f:ajax</code> for changing the page, and in the <code>oncomplete</code> pass the <code>widgetVar</code> value for the table and have a common method that will update the pagination based on properties of that datatable in JS. This seems like overkill and I don't want to over-complicate the code if I don't have to.</p>
  
  <p>Is there any better way to go about this? Does anyone have any other suggestions?</p>