在PrimeFaces中过滤数据表

时间:2015-02-11 14:23:51

标签: primefaces jstl

我试图过滤包含数据表的列,但它包含列。我想要的是由父列数据datatable daughter过滤。示例

 Model    Color
+-- +---+------+
|       | Red  |  
+Toyota +------+
|       | Blue |
+-------+------+
|       | Red  |
+Susuki +------+
|       | White|
+-------+------+      

按红色过滤时的预期结果

     Model    Color
    +-- +---+------+
    |Toyota | Red  |  
    +-------+------+
    |Susuki | Red  |
    +-------+------+

在此表中,我想列出红色,但不会过滤。

我的源代码

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"

    xmlns:p="http://primefaces.org/ui">

<f:view>
    <h:head />
    <h:body>
        <h:form>
            <p:autoComplete var="carac" converter="carconvertor"
                value="#{testBean.selectedCar}" itemLabel="#{carac.carmodel}"
                itemValue="#{carac}"
                completeMethod="#{testBean.complete}" process="@this"
                onSelectUpdate="idGrid">
                <p:ajax event="keyup" listener="#{testBean.onValueChange}"
                    update="idGrid"></p:ajax>
            </p:autoComplete>

            <p:dataTable value="#{testBean.matchingCarModels}" var="carmatch"
                id="idGrid" converter="carconvertor" widgetVar="carsTable" filteredValue="#{pwBean.filteredCars}"
                 binding="#{table}"
                >


                   <p:column headerText="Trabajador">
                           <h:outputText value="#{carmatch.carmodel}" />

                           <c:set var="dateParts" value="${fn:split(pwBean.getCounterWorker(carmatch.carmodel), ',')}" />


                    </p:column>

          <p:column filterBy="#{carmatch.name}" headerText="" footerText="" filterMatchMode="in" filter="true">
            <f:facet name="filter">
                <p:selectCheckboxMenu label="Proyectos" onchange="PF('carsTable').filter()" panelStyle="width:125px" scrollHeight="150">
                    <f:selectItems value="#{pwBean.manufacturerOptions}" />
                </p:selectCheckboxMenu>
            </f:facet>
           <!--    <h:outputText value="#{carmatch.name}"/> -->




            <h:dataTable  value="#{testBean.getCounterWorker(carmatch.carmodel)}" var="work" columnClasses="no-border, no-border" rendered="#{not empty pwBean.getCounterWorker(carmatch.carmodel)}">

                            <h:column>

                                           <h:outputText value="#{work.carmodel}" />

                           </h:column>
             </h:dataTable> 

               <!--   
        </p:column>

        <p:column filterBy="#{pwBean.getCounterWorker(carmatch.carmodel)}" headerText="Proyectos" footerText="exact" filterOptions="#{pwBean.manufacturerOptions}"  
                filterMatchMode="exact">  


              <h:outputText value="#{carmatch.name}" />



        </p:column>  
                    <p:column >
                    <c:set value="34" var="num"/>





                         <h:dataTable  value="#{pwBean.getCounterWorker(carmatch.carmodel)}" var="work" columnClasses="no-border, no-border" rendered="#{not empty pwBean.getCounterWorker(carmatch.carmodel)}">


                            <h:column >
                                            <h:outputText value="#{work.nombre}"/>
                           </h:column>

                        </h:dataTable>


                    -->
                    </p:column>




            </p:dataTable>

        </h:form>
    </h:body>
</f:view>
</html>

修改

Image datatable  Image Datatable with filters

我希望透过单元格的每个元素,这是一个数据表。

0 个答案:

没有答案