Primefaces dataTable过滤器不适用于commandLink更新

时间:2013-09-16 13:27:58

标签: jsf-2 primefaces

我想对dataTable的某些列应用一些过滤器。其中一列包含commandLink,此commandLink更新一些组件。我只能通过以下路径更新这些组件:update =“:summaryForm:component1,:summaryForm:component2,...”。每当我应用过滤器时,我都会遇到以下异常:

错误:

javax.faces.FacesException: Cannot find component with identifier ":contentForm:summaryDylgId" referenced from "ctxMenuButton".
at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:250)
at org.primefaces.util.AjaxRequestBuilder.addIds(AjaxRequestBuilder.java:102)
at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:90)
at org.primefaces.renderkit.CoreRenderer.buildAjaxRequest(CoreRenderer.java:200)
at org.primefaces.component.commandlink.CommandLinkRenderer.encodeEnd(CommandLinkRenderer.java:67)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1903)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1899)
at org.primefaces.component.datatable.DataTableRenderer.encodeCell(DataTableRenderer.java:808)
at org.primefaces.component.datatable.DataTableRenderer.encodeRow(DataTableRenderer.java:773)
at org.primefaces.component.datatable.DataTableRenderer.encodeTbody(DataTableRenderer.java:651)
at org.primefaces.component.datatable.feature.FilterFeature.encode(FilterFeature.java:142)
at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1903)
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:559)
at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
at org.primefaces.component.api.UIData.visitTree(UIData.java:639)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1740)
at javax.faces.component.UIForm.visitTree(UIForm.java:371)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1740)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1740)
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:399)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:319)
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:219)
at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:218)
at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1004)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1896)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:425)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

每当我删除update属性时,过滤都会起作用。这是我的数据表:

<p:dataTable id="vehicleTable" var="vhcl" value="#{home.vehicleList}"
scrollable="true" scrollHeight="480"
style="width:420px;margin: 0px; padding: 0px;" binding="#{home.vehicleTable}"
filteredValue="#{home.filteredVehicles}" >
<p:column id="col_sel" width="15">
    <f:facet name="header">
        <h:selectBooleanCheckbox title="#{general.selectAll}"/>
    </f:facet>
    <p:selectBooleanCheckbox label="#{general.showOnMap}" onchange="showOnMap(this);" id="selectedCheckBox" />
</p:column>
<p:column id="trackId" label="#{general.vehicleName}" width="120"
    filterBy="#{vhcl.vehicle.mtsTrackId}" style="spacing:0;padding:0;border:0px">
    <f:facet name="header">
        <h:outputText id="state_name" value="#{general.vehicleName}" styleClass="tableCellHeader"/>
    </f:facet>
    <p:commandLink id="ctxMenuButton" update=":contentForm:summaryDylgId, :contentForm:notBarTop" 
        title="#{general.extra}" action="#{home.setSelected}" style="border: 0;" immediate="true" oncomplete="summaryDylg.show();" >
        <h:outputText value="#{vhcl.vehicle.vehicleName}" 
            id="trackIdVal" title="#{general.extra}" style="font-weight:bold; font-size:11px;" />
    </p:commandLink>
</p:column>
<p:column  id="type_col" label="#{general.vehicleType}" width="100" filterBy="#{vhcl.vehicle.vehicleType.vehicleTypeName}">
    <f:facet name="header">
        <h:outputText value="#{general.vehichleType}" id="vehichleTypeLabel" styleClass="tableCellHeader"/>
    </f:facet>
    <h:graphicImage id="vhclTypeImage" value="#{vhcl.typeImage}" height="40" width="40"/>
</p:column>
<p:column id="msg_col" label="#{general.lastMessageDate}" width="100">
    <f:facet name="header">
        <h:outputText value="#{general.lastMessageDate}" id="lastMsgDateLabel" styleClass="tableCellHeader"/>
    </f:facet>
    <h:outputText id="lastMsgDate" value="#{vhcl.messageDate}" styleClass="tableCell"/> 
</p:column>

我的摘要对话框内容:

<p:dialog id="summaryDylgId"  header="#{general.briefInfo}" styleClass="tableCellHeader" widgetVar="summaryDylg" showEffect="slide" hideEffect="blind" >  
<p:accordionPanel id="summaryAcc" dynamic="true" cache="true" styleClass="tableCellHeader">
    <p:tab title="#{general.vehicleInfo}" styleClass="tableCellHeader">
        <p:panelGrid style="width:950px; overflow-x:auto">
            <f:facet name="header">
                <p:row>
                    <p:column colspan="8">
                        <h:outputText value="#{home.selectedVehicle.vehicleName} : " styleClass="tableCellHeader"/> 
                        <h:outputText id="selectedVhclName" value="#{general.vehicleInfo}" styleClass="tableCellHeader"/>
                    </p:column>
                </p:row>
                <p:row>
                    <p:column>
                        <h:outputText value="#{general.vehicleId}" styleClass="tableCellHeader"/> 
                    </p:column>
                    <p:column>
                        <h:outputText value="#{general.licencePlate}" styleClass="tableCellHeader"/> 
                    </p:column>
                    <p:column>
                        <h:outputText value="#{general.serialNumber}" styleClass="tableCellHeader"/> 
                    </p:column>
                    <p:column>
                        <h:outputText value="#{general.brand}" styleClass="tableCellHeader"/> 
                    </p:column>
                    <p:column>
                        <h:outputText value="#{general.model}" styleClass="tableCellHeader"/> 
                    </p:column>
                    <p:column>
                        <h:outputText value="#{general.totalFeulConsumption}" styleClass="tableCellHeader"/> 
                    </p:column>
                    <p:column>
                        <h:outputText value="#{general.dailyFuelConsumption}" styleClass="tableCellHeader"/> 
                    </p:column>
                    <p:column>
                        <h:outputText value="#{general.remainingTime}" styleClass="tableCellHeader"/> 
                    </p:column>
                </p:row>
            </f:facet>
            <p:row>
                <p:column>
                    <h:outputText id="selectedVhclId" value="#{home.selectedVehicle.mtsTrackId}" styleClass="tableCell"/>
                </p:column>
                <p:column>
                    <h:outputText id="selectedVhclPlate" value="#{home.selectedVehicle.vehiclePlate}" styleClass="tableCell"/>
                </p:column>
                <p:column>
                    <h:outputText id="selectedVhclSrlNmbr" value="#{home.selectedVehicle.registrationId.serialNumber}" styleClass="tableCell"/>
                </p:column>
                <p:column>
                    <h:outputText id="selectedVhclBrand" value="#{home.selectedVehicle.registrationId.brand.brandName}" styleClass="tableCell"/>
                </p:column>
                <p:column>
                    <h:outputText id="selectedVhclModel" value="#{home.selectedVehicle.registrationId.model.modelName}" styleClass="tableCell"/>
                </p:column>
                <p:column>
                    <h:outputText id="selectedVhclTotalFuelCons" value="#{home.totalFuelConsumption} lt" styleClass="tableCell"/>
                </p:column>
                <p:column>
                    <h:outputText id="selectedVhclDailyFuelCons" value="#{home.dailyFuelConsumption} lt" styleClass="tableCell"/>
                </p:column>
                <p:column>
                    <h:outputText id="selectedVhclRemTime" value="#{home.remainingTime}" styleClass="tableCell"/>
                </p:column>
            </p:row>
        </p:panelGrid>
    </p:tab>
</p:accordionPanel>

0 个答案:

没有答案