0

我正在尝试创建一个复合组件,它将值显示为覆盖面板。但它返回以下错误;在视图中找不到组件“j_idt58:reviewDataTable:0:overrideCol”

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>

非常感谢任何帮助。

4

1 回答 1

0

我不使用 Primefaces,但使用 RichFaces 我会使用:

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

做你想做的事。

借助 SO 的一点帮助: Rich Faces rich:Primefaces 中的 clientId? 看来你可以这样做:

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

现在看看这是否比在数据表中使用更好binding......

于 2013-10-21T11:41:45.187 回答