2014-08-28 30 views
1

我目前正在研究JSF項目的查找表。 我有這張表,它將在鏈接到數據庫後顯示大量代碼(現在是硬編碼數據),因此我添加了primefaces 5.0分頁。這裏的問題是,當我爲特定代碼創建表時,發生了一個Bug,更改了代碼,然後返回到此表。 Look what happensPrimeFaces分頁錯誤;無限數量的頁面

enter image description here

的頁面只有3個數據的無限多......每一頁都是一樣的,如果我改變每頁結果的數量,問題消失。

下面是在代碼表:

<h:form id="currentTable"> 
    <p:growl id="msgs" showDetail="true"/> 
    <p:dataTable widgetVar="dataTableWidgetVar" var="lookupRow" 
       value="#{lookupsView.currentLookup.lookupRows}" editable="true" 
       style="margin-bottom:20px" 
       styleClass="tableWrapText" 
       paginator="true" 
       paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
       rowsPerPageTemplate="10, 20, 30, 40, 50, 100, 200" 
       filteredValue="#{lookupsView.filteredLookupRows}"> 

     <p:ajax event="rowEdit" update=":currentTable:msgs" listener="#{lookupsView.onRowEdit}"/> 
     <p:ajax event="rowEditCancel" update=":currentTable:msgs" 
       listener="#{lookupsView.onRowCancel}"/> 
     <p:column headerText="XBRL Code" filterBy="#{lookupRow.xbrlCodeMember.memberValue}" 
        footerText="contains" filterMatchMode="contains"> 
      <h:outputText value="#{lookupRow.xbrlCodeMember.memberValue}"/> 
     </p:column> 
     <p:column headerText="Client Code " filterBy="#{lookupRow.clientCode}" footerText="contains" 
        filterMatchMode="contains"> 
      <p:cellEditor> 
       <f:facet name="output"> <h:outputText value="#{lookupRow.clientCode}"/></f:facet> 
       <f:facet name="input"><p:inputText value="#{lookupRow.clientCode}" style="width:100%"/></f:facet> 
      </p:cellEditor> 
     </p:column> 
     <p:column headerText="XBRL Label" filterBy="#{lookupRow.xbrlCodeMember.memberDescription}" 
        footerText="contains" filterMatchMode="contains"> 
      <h:outputText value="#{lookupRow.xbrlCodeMember.memberDescription}"/> 
     </p:column> 
     <p:column headerText="Client Label" filterBy="#{lookupRow.clientDescription}" 
        footerText="contains" filterMatchMode="contains"> 
      <p:cellEditor> 
       <f:facet name="output"><h:outputText value="#{lookupRow.clientDescription}"/></f:facet> 
       <f:facet name="input"><p:inputText value="#{lookupRow.clientDescription}" 
                style="width:100%"/></f:facet> 
      </p:cellEditor> 
     </p:column> 
     <p:column style="width:32px"> 
      <p:rowEditor/> 
     </p:column> 
    </p:dataTable> 
</h:form> 

你知道這個錯誤可能是從哪裏來的? 它在Jboss7服務器上。

+0

您是否在真實代碼中定義了''行? – Tiny 2014-08-28 20:26:28

+0

@Tiny是的一切都已定義,所有的數據顯示正確,可以保存,刪除等... – 2014-08-29 12:26:26

回答

1

我找到了解決方案,它發生是因爲「#{lookupsView.filteredLookupRows}」變量,您必須通過將其設置爲空來清理,每次更改顯示哪個表或它以某種方式中斷時都會清除。