2017-02-04 2 views
0

도움이 필요합니다. 누군가가 도와 주면 감사 할 것입니다.Primefaces : FacesContext의 페이지 매김 요소

페이지 설정이있는 Datatable이 있고 Datagable (관리 Bean) 외부에서 paginatorTemplate (RowsPerPageDropdown 및 CurrentPageReport)의 페이지 매김 데이터를 가져 오려면 어떻게해야합니까?

테이블 형태로되어 다음과 같습니다 :

<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" > ... 

첫 단추를 데이터로 테이블을 채 웁니다 (그리고 잘 작동) :

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

내가 매김 데이터를 얻으려고 두 번째 버튼으로 (RowsPerPageDropdown 및 CurrentPageReport에서 선택) :

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

및 빈 방법 :

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()); 
    } 
} 

bean 메소드에서 RowsPerPageDropdown 목록 및 CurrentPageReport의 실제/현재 값에 어떻게 액세스합니까?

미리 감사드립니다.

+0

primefaces에 데이터 테이블 게으른를 살펴 보자는 전시 : http://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml을 나는 정확하게 당신이 필요하다고 생각합니다. –

+0

Jorge 대단히 감사합니다. 내가 보낸 링크를 보았습니다. 그게 내가 필요한거야. – kenanze

답변

관련 문제