0

如何在过滤数据表中使用 globalFilter。我在所有列中使用 filterBy 但这里基于列的过滤器只工作我希望全局过滤器根据搜索词获取记录......

    <p:dataTable value="#{dataTableBean.usermodel}" var="datadto" paginator="true" rows="10"
                paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                rowsPerPageTemplate="2,5,10,15" widgetVar="dataTable" filteredValue="#{dataTableBean.userlist}">


    <f:facet name="header">  
        <p:outputPanel>  
            <h:outputText value="Search all fields:" />  
            <p:inputText id="globalFilter" onkeyup="PF('dataTable').filter()" style="width:150px" />  
        </p:outputPanel>  
    </f:facet>  

      <p:column headerText="CompanyId" filterBy="#{datadto.companyId}" filterStyle="display:none">
            <h:outputText value="#{datadto.companyId}"/>
        </p:column>

        <p:column headerText="CompanyName" filterBy="#{datadto.companyName}" filterStyle="display:none">
            <h:outputText value="#{datadto.companyName}"/>
        </p:column>

        <p:column headerText="CompanyDomain" filterBy="#{datadto.companyDomain}" filterStyle="display:none">
            <h:outputText value="#{datadto.companyDomain}"/>
        </p:column>

        <p:column headerText="TotalEmployees" filterBy="#{datadto.totalEmployees}" filterStyle="display:none">
            <h:outputText value="#{datadto.totalEmployees}"/>
        </p:column>

        <p:column headerText="CompanyId" filterBy="#{datadto.salaryDetails}" filterStyle="display:none">
            <h:outputText value="#{datadto.salaryDetails}"/>
        </p:column>
 </p:dataTable>
4

1 回答 1

0
<f:facet name="header">  
        <p:outputPanel>  
            <h:outputText value="Search all fields:" />  
            <p:inputText id="globalFilter" onkeyup="dataTable.filter()" style="width:150px" />  
        </p:outputPanel>  
</f:facet>  
于 2014-01-18T06:24:42.130 回答