Jsf 如何知道数据表是否在Primefaces 5中过滤

Jsf 如何知道数据表是否在Primefaces 5中过滤,jsf,jsf-2,primefaces,filter,datatable,Jsf,Jsf 2,Primefaces,Filter,Datatable,最近,我从JSF2.0迁移到JSF2.2,从Primefaces 3.5迁移到Primefaces 5 我有一个表,每列都有过滤器。使用primefaces 3.5进行过滤效果良好 <p:dataTable id="gwsReportAllPartListDataTable" value="#{viewAllAnalyticsBean.gwsReportPartTwoList}"

最近,我从JSF2.0迁移到JSF2.2,从Primefaces 3.5迁移到Primefaces 5

我有一个表,每列都有过滤器。使用primefaces 3.5进行过滤效果良好

<p:dataTable  id="gwsReportAllPartListDataTable" 
                                          value="#{viewAllAnalyticsBean.gwsReportPartTwoList}" 
                                          var="report" 
                                          paginator="true" 
                                          rows="100"
                                          paginatorTemplate="{PageLinks} {CurrentPageReport}" 
                                          currentPageReportTemplate="{currentPage} #{dictionary['out_of']} {totalPages}" 
                                          emptyMessage="#{dictionary['nothing_is_here']}" 
                                          scrollable="true"
                                          scrollWidth="1221"
                                          scrollHeight="500">

                                <p:ajax event="filter"  listener="#{viewAllAnalyticsBean.onFilterDataTable}" oncomplete="updateFilters()"/>

                                <p:column  styleClass="columnCustomClass" style="width: 90px;position:relative; padding-bottom: 30px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['reporting_period']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.year}, #{report.gwsReportPartOne.quarter}"/>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 90px;position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.contractNumber}" filterMatchMode="contains" filterStyle="width:80px; position:absolute; bottom:4px;" filterValue="">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['subsoil_user_contract_register_number']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.contractNumber}"/>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 40px;position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.gwsType.code}" filterMatchMode="contains" filterStyle="width:30px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['gws_type']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.gwsType.code}" />
                                </p:column>
                                <p:column id="tender_code" width="100" style="position:relative; padding-bottom: 30px;" styleClass="columnCustomClass" filterBy="#{report.skp.code}" filterMatchMode="contains" filterStyle="width:90px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['gws_code_by_skp']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.skp.code}"/>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 150px; position:relative; padding-bottom: 30px;" filterBy="#{report.description}" filterMatchMode="contains" filterStyle="width:140px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['item_name_and_short_description_of_purchased_gws']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.description}" />
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 50px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.tenderType.code}" filterMatchMode="contains" filterStyle="width:40px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['purchase_way']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.tenderType.code}" />
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementNumber}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['agreement_number']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.agreementNumber}" />
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.resultDate}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['tender_result_date']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.resultDate}" >
                                        <f:convertDateTime pattern="dd.MM.yyyy"/>
                                    </h:outputText>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementStartDate}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['agreement_conclusion_date']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.agreementStartDate}" >
                                        <f:convertDateTime pattern="dd.MM.yyyy"/>
                                    </h:outputText>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementEndDate}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['agreement_deadline_date']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.agreementEndDate}" >
                                        <f:convertDateTime pattern="dd.MM.yyyy"/>
                                    </h:outputText>                                   
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 50px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementStatus.code}" filterMatchMode="contains" filterStyle="width:40px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['agreement_status']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.agreementStatus.code}" />
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementSum}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['total_sum_of_agreement_without_vat']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
                                    </f:facet>
                                    <h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.gwsReportPartOne.agreementSum)}">
                                        <f:convertNumber pattern="0.00#" locale="ru-RU"/>
                                    </h:outputText>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.plannedSum}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['planned_sum_in_gpz_without_vat']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
                                    </f:facet>
                                    <h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.gwsReportPartOne.plannedSum)}" >
                                        <f:convertNumber pattern="0.00#" locale="ru-RU"/>
                                    </h:outputText>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.actuallyPaidSum}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['actually_paid_sum_for_report_period_of_agreement_without_vat']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
                                    </f:facet>
                                    <h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.gwsReportPartOne.actuallyPaidSum)}" >
                                        <f:convertNumber pattern="0.00#" locale="ru-RU"/>
                                    </h:outputText>
                                </p:column>
                                <p:column  styleClass="columnCustomClass" style="width: 100px; position:relative; padding-bottom: 30px; background-color: #{two.gwsSumWithoutVatColor}" filterBy="#{report.gwsSumWithoutVat}" filterMatchMode="contains" filterStyle="width:90px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['tender_volume_without_vat_in_price']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
                                    </f:facet>
                                    <h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.gwsSumWithoutVat)}">
                                        <f:convertNumber pattern="0.00#" locale="ru-RU"/>
                                    </h:outputText>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.supplierBinOrIin}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['supplier_bin_iin']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.supplierBinOrIin}" />
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 150px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.supplierName}" filterMatchMode="contains" filterStyle="width:140px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['supplier_gws_name']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.supplierName}" />
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 60px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.supplierCountry.code}" filterMatchMode="contains" filterStyle="width:50px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['supplier_gws_country']}" />
                                    </f:facet>
                                    <h:outputText value="#{report.gwsReportPartOne.supplierCountry.code}" />
                                </p:column>

                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.kazcontent}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['local_content_piece']}, %" />
                                    </f:facet>
                                    <h:outputText value="#{report.kazcontent}" >
                                        <f:convertNumber pattern="0.00#" locale="ru-RU"/>
                                    </h:outputText>
                                    <ui:remove><h:outputText value="#{report.kazcontentInService}" >
                                            <f:convertNumber pattern="0.00#" locale="ru-RU"/>
                                        </h:outputText></ui:remove>
                                </p:column>
                                <p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.procurementSumOfLocalContentOfGws}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
                                    <f:facet name="header">
                                        <h:outputText value="#{dictionary['procurement_sum_of_local_content_of_tru']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
                                    </f:facet>
                                    <h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.procurementSumOfLocalContentOfGws)}" >
                                        <f:convertNumber pattern="0.00#" locale="ru-RU"/>
                                    </h:outputText>
                                </p:column>

                                <p:columnGroup type="footer">  
                                    <p:row>  
                                        <p:column footerText="#{dictionary['totals']}: " style="text-align:right"/>  
                                        <p:column footerText="" />  
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="#{viewAllAnalyticsBean.totalAgreementSum}" />
                                        <p:column footerText="#{viewAllAnalyticsBean.totalPlannedSum}" />
                                        <p:column footerText="#{viewAllAnalyticsBean.totalActualPaid}" />
                                        <p:column footerText="#{viewAllAnalyticsBean.totalGwsSum}" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="" />
                                        <p:column footerText="#{viewAllAnalyticsBean.averageKazContent} %" />
                                        <p:column footerText="#{viewAllAnalyticsBean.totalGwsLocalContent}" />
                                    </p:row>  
                                </p:columnGroup>  
                            </p:dataTable>
但在Primefaces中,我看到当Primefaces 3.5返回就绪过滤列表时,getFilteredValue()返回null


有什么问题?以及如何检查数据表是否显示服务器端已过滤的数据?

我同样的事情也发生在从3.5版移动到4.0版的过程中。 我使用remotecomand调用actionlistener方法解决了这个问题

 <p:dataTable filterDelay="1000"  emptyMessage="No se encontraron elementos"  widgetVar="tb1"  
                             id="tablaFact" var="item" selection="#{listadoFacturasMB.selectedFactura}" selectionMode="single"  paginator="true" 
                             rows="20" rowKey="#{item.idFactura}" value="#{listadoFacturasMB.facturaUtilList}" filteredValue="#{listadoFacturasMB.filterFacturaUtilList}"> 

 <p:ajax event="filter" oncomplete="handleLoadStart();" update=":frm1:tablaFact :frm1:panelTotal"/>
   <p:column style="width:10%" headerText="Importe Total" id="cff3">                   
      <h:outputText value="#{item.importeTotal}"/>
   </p:column>                                 

   <p:column style="width:10%" headerText="Importe CUC" id="cjj3">                   
       <h:outputText value="#{item.importeCuc}"/>
   </p:column>                      
</p:dataTable> 
 <p:remoteCommand id="rcom" name="loadRemoteContent" process="@this" update="panelTotal, tablaFact"  
                     actionListener="#{listadoFacturasMB.filterListener2}"/>  

我知道同样的事情也发生在从3.5版到4.0版的过程中。 我使用remotecomand调用actionlistener方法解决了这个问题

 <p:dataTable filterDelay="1000"  emptyMessage="No se encontraron elementos"  widgetVar="tb1"  
                             id="tablaFact" var="item" selection="#{listadoFacturasMB.selectedFactura}" selectionMode="single"  paginator="true" 
                             rows="20" rowKey="#{item.idFactura}" value="#{listadoFacturasMB.facturaUtilList}" filteredValue="#{listadoFacturasMB.filterFacturaUtilList}"> 

 <p:ajax event="filter" oncomplete="handleLoadStart();" update=":frm1:tablaFact :frm1:panelTotal"/>
   <p:column style="width:10%" headerText="Importe Total" id="cff3">                   
      <h:outputText value="#{item.importeTotal}"/>
   </p:column>                                 

   <p:column style="width:10%" headerText="Importe CUC" id="cjj3">                   
       <h:outputText value="#{item.importeCuc}"/>
   </p:column>                      
</p:dataTable> 
 <p:remoteCommand id="rcom" name="loadRemoteContent" process="@this" update="panelTotal, tablaFact"  
                     actionListener="#{listadoFacturasMB.filterListener2}"/>  

我知道同样的事情也发生在从3.5版到4.0版的过程中。 我使用remotecomand调用actionlistener方法解决了这个问题

 <p:dataTable filterDelay="1000"  emptyMessage="No se encontraron elementos"  widgetVar="tb1"  
                             id="tablaFact" var="item" selection="#{listadoFacturasMB.selectedFactura}" selectionMode="single"  paginator="true" 
                             rows="20" rowKey="#{item.idFactura}" value="#{listadoFacturasMB.facturaUtilList}" filteredValue="#{listadoFacturasMB.filterFacturaUtilList}"> 

 <p:ajax event="filter" oncomplete="handleLoadStart();" update=":frm1:tablaFact :frm1:panelTotal"/>
   <p:column style="width:10%" headerText="Importe Total" id="cff3">                   
      <h:outputText value="#{item.importeTotal}"/>
   </p:column>                                 

   <p:column style="width:10%" headerText="Importe CUC" id="cjj3">                   
       <h:outputText value="#{item.importeCuc}"/>
   </p:column>                      
</p:dataTable> 
 <p:remoteCommand id="rcom" name="loadRemoteContent" process="@this" update="panelTotal, tablaFact"  
                     actionListener="#{listadoFacturasMB.filterListener2}"/>  

我知道同样的事情也发生在从3.5版到4.0版的过程中。 我使用remotecomand调用actionlistener方法解决了这个问题

 <p:dataTable filterDelay="1000"  emptyMessage="No se encontraron elementos"  widgetVar="tb1"  
                             id="tablaFact" var="item" selection="#{listadoFacturasMB.selectedFactura}" selectionMode="single"  paginator="true" 
                             rows="20" rowKey="#{item.idFactura}" value="#{listadoFacturasMB.facturaUtilList}" filteredValue="#{listadoFacturasMB.filterFacturaUtilList}"> 

 <p:ajax event="filter" oncomplete="handleLoadStart();" update=":frm1:tablaFact :frm1:panelTotal"/>
   <p:column style="width:10%" headerText="Importe Total" id="cff3">                   
      <h:outputText value="#{item.importeTotal}"/>
   </p:column>                                 

   <p:column style="width:10%" headerText="Importe CUC" id="cjj3">                   
       <h:outputText value="#{item.importeCuc}"/>
   </p:column>                      
</p:dataTable> 
 <p:remoteCommand id="rcom" name="loadRemoteContent" process="@this" update="panelTotal, tablaFact"  
                     actionListener="#{listadoFacturasMB.filterListener2}"/>  

在PF 5.0中,您需要明确定义
filteredValue

<p:dataTable  id="gwsReportAllPartListDataTable" 
  value="#{viewAllAnalyticsBean.gwsReportPartTwoList}" 
  var="report" 
  paginator="true" 
  rows="100"
  paginatorTemplate="{PageLinks} {CurrentPageReport}" 
  currentPageReportTemplate="{currentPage} #{dictionary['out_of']} {totalPages}" 
  emptyMessage="#{dictionary['nothing_is_here']}" 
  scrollable="true"
  scrollWidth="1221"
  scrollHeight="500"

  filteredValue="#{someBeanOrScope.someList}">

在PF 5.0中,您需要明确定义
filteredValue

<p:dataTable  id="gwsReportAllPartListDataTable" 
  value="#{viewAllAnalyticsBean.gwsReportPartTwoList}" 
  var="report" 
  paginator="true" 
  rows="100"
  paginatorTemplate="{PageLinks} {CurrentPageReport}" 
  currentPageReportTemplate="{currentPage} #{dictionary['out_of']} {totalPages}" 
  emptyMessage="#{dictionary['nothing_is_here']}" 
  scrollable="true"
  scrollWidth="1221"
  scrollHeight="500"

  filteredValue="#{someBeanOrScope.someList}">

在PF 5.0中,您需要明确定义
filteredValue

<p:dataTable  id="gwsReportAllPartListDataTable" 
  value="#{viewAllAnalyticsBean.gwsReportPartTwoList}" 
  var="report" 
  paginator="true" 
  rows="100"
  paginatorTemplate="{PageLinks} {CurrentPageReport}" 
  currentPageReportTemplate="{currentPage} #{dictionary['out_of']} {totalPages}" 
  emptyMessage="#{dictionary['nothing_is_here']}" 
  scrollable="true"
  scrollWidth="1221"
  scrollHeight="500"

  filteredValue="#{someBeanOrScope.someList}">

在PF 5.0中,您需要明确定义
filteredValue

<p:dataTable  id="gwsReportAllPartListDataTable" 
  value="#{viewAllAnalyticsBean.gwsReportPartTwoList}" 
  var="report" 
  paginator="true" 
  rows="100"
  paginatorTemplate="{PageLinks} {CurrentPageReport}" 
  currentPageReportTemplate="{currentPage} #{dictionary['out_of']} {totalPages}" 
  emptyMessage="#{dictionary['nothing_is_here']}" 
  scrollable="true"
  scrollWidth="1221"
  scrollHeight="500"

  filteredValue="#{someBeanOrScope.someList}">