title: How to jump in Primefaces dataTable to last page from the bean?
body: <p>I have into my .xhtml a datatable looking like this :</p>
  
  <pre><code>&lt;p:dataTable var="category" value="#{beanView.categories}" paginator="true" rows="5" 
   paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
   rowsPerPageTemplate="5,10" id="categoryDT" styleClass="categoryClass"    
   editable="true" lazy="false" rowKey="#{category.id}"&gt;
   &lt;!-- columns --&gt;
  &lt;f:facet name="footer"&gt;
      &lt;p:commandButton id="btnNewCat" 
        oncomplete="jQuery('.categoryClass').find('span.ui-icon-pencil').last().click();" 
      actionListener="#{beanView.onNewCategory}" 
      update="categoryDT" icon="ui-icon-plus" title="New Category" value="New Category" &gt;&lt;/p:commandButton&gt;
  &lt;/f:facet&gt;&lt;/p:dataTable&gt;
  </code></pre>
  
  <p>And my bean <strong>beanView</strong> : </p>
  
  <pre><code>public void onNewCategory(final ActionEvent actionEvent) {
  
      try {
          int rowCount = dataTable.getRowCount();
          int rowsPerPage = dataTable.getRows();
          int lastPage = rowCount / rowsPerPage;
          int rowFirst = (lastPage * rowsPerPage);
  
          if (rowCount &gt;= rowsPerPage) {
              dataTable.setFirst(rowFirst);
              dataTable.setPageLinks(lastPage + 1);
              dataTable.setRowIndex(rowCount - 1);
          } else {
              ....
          }
  
          ....
       }
   }
  </code></pre>
  
  <p>But this actually doesnt work! the last page will not be show!</p>
  
  <p>It's possible to Click on the last Page button of my datatable from the bean? or is there another way to solve it!</p>
  
  <p>Thanks for helping</p>