0

I need help. If someone can help I would be grateful.

I have a Datatable with pagination and I want to have Pagination data from paginatorTemplate (RowsPerPageDropdown and CurrentPageReport) outside the Datatable (in Managed Bean), how I can get it?

Table is in form and looks like follows:

<h:form id="form"> 
<p:dataTable id="myDataTable" var="member" 
value="#bean01MyWorkspaces.dqaSqlsExecutiveBeanList}" rows="1" paginator="true"
currentPageReportTemplate="Showing {startRecord}-{endRecord} out of {totalRecords}"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="2,3,4" > ...

First button fills table with data (and works fine):

<p:commandButton value="User Datasources"
action="#{bean01MyWorkspaces.initDqaSqlsExecutiveBeanList()}"
style="width:100%;height:100%; margin-bottom: 5px"
update="myDataTable"/>

With Second button I'm trying to get pagination data (selection from RowsPerPageDropdown and CurrentPageReport):

<p:commandButton value="User Datasources 2"
action="#{bean01MyWorkspaces.changeMethod}"
style="width:100%;height:100%; margin-bottom: 5px"
/>
</h:form> 

And Bean Method is:

public void changeMethod() {
    final DataTable d = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent("form:myDataTable");
    int first = 1;
    if(d == null){
        System.out.println("SYSTEM is NULL V"  );
    }else{
        System.out.println("getRowCount is NOT NULL " +d.getRowCount() );
        System.out.println("getCurrentPageReportTemplate is NOT NULL " +d.getCurrentPageReportTemplate());
    }
}

How can I access to actual/current values in RowsPerPageDropdown list and CurrentPageReport from bean method?

Thanks in advance!

kenanze
  • 1
  • 1
  • Take a look at the Datatable Lazy on primefaces showcase: http://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml I think it is exactly what you need. – Jorge Campos Feb 04 '17 at 23:32
  • Thank you very much Jorge. I have looked link you have sent. That's what I need. – kenanze Feb 18 '17 at 05:22

1 Answers1

0

In situation like this Instead of DataTable - Basic use DataTable - Lazy.

Primefaces SHOWCASE DataTable - Lazy

kenanze
  • 1
  • 1