2013-10-08 46 views
0

我正在嘗試創建一個將顯示值作爲overlaypanel的複合組件。但它返回下面的錯誤; 找不到組件 'j_idt58:reviewDataTable:0:overrideCol' 鑑於無法在複合組件內使用p:overlaypanel

overrideVersionDetails.xhtml:(複合成分)

<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:cc="http://java.sun.com/jsf/composite" 
    xmlns:p="http://primefaces.org/ui" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:fn="http://java.sun.com/jsp/jstl/functions" 
    xmlns:c="http://java.sun.com/jsp/jstl/core"> 

    <cc:interface> 
     <cc:attribute name="forId" type="java.lang.String" required="true" /> 
     <cc:attribute name="forValue" type="java.lang.Object" /> 
    </cc:interface> 

    <cc:implementation> 
     <p:overlayPanel for="#{cc.attrs.forId}" my="left bottom"> 
      #{cc.attrs.forValue} 
     </p:overlayPanel> 
    </cc:implementation> 
</ui:composition> 

它在另一個頁面中使用:

<h:form> 
.... 
... 
<p:dataTable .....> 
.... 
    <p:column sortBy="#{dto.isSameCycleOverride}" width="100"> 
     <f:facet name="header"> 
      Override 
     </f:facet> 
     <h:commandLink id="overrideCol" binding="#{overrideCol}" 
     value="#{(dto.isSameCycleOverride) ? 'Yes' : 'No'}" /> 
    <comp:overrideVersionDetails forId="#{overrideCol.clientId}" 
    forValue="#{dto.message}" /> 
    </p:column> 
.... 
</p:dataTable> 
</h:form> 

任何幫助非常感謝。

回答

0

我不Primefaces工作,但與RichFaces的,我會用:

<comp:overrideVersionDetails forId="#{rich:clientId('overrideCol')}" 
          forValue="#{dto.message}" /> 

做你想做什麼。

從那麼一點點的幫助: Rich Faces rich:clientId in Primefaces? 似乎你可以這樣做:

... 
<h:commandLink id="overrideCol" value="#{(dto.isSameCycleOverride) ? 'Yes' : 'No'}" /> 
<comp:overrideVersionDetails forId="#{p:component('overrideCol')}" 
forValue="#{dto.message}" /> 
... 

我們看看這個作品比使用binding數據表中的更好...