过滤PrimeFaces中的数据表
我试图筛选一个包含datatable的列,它包含列。我想要的是通过父列数据datatable子项进行过滤。范例过滤PrimeFaces中的数据表,primefaces,jstl,Primefaces,Jstl,我试图筛选一个包含datatable的列,它包含列。我想要的是通过父列数据datatable子项进行过滤。范例 Model Color +-- +---+------+ | | Red | +Toyota +------+ | | Blue | +-------+------+ | | Red | +Susuki +------+ | | White| +-------+------+ 红色过滤时的预期结果 在这个表中
Model Color
+-- +---+------+
| | Red |
+Toyota +------+
| | Blue |
+-------+------+
| | Red |
+Susuki +------+
| | White|
+-------+------+
红色过滤时的预期结果
在这个表中,我想列出红色,但不过滤
我的源代码
<!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>
编辑
我希望深入了解单元格的每一个元素,这是一个数据表。你能展示一下你用这段代码看到的结果吗?然后显示您希望结果的外观。使用链接中的图像进行编辑,谢谢您的评论
<!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>