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!