下面的代码在布局中实现了一个数据表,在数据表中我添加了一个菜单按钮,其菜单项在点击它之后更新对话框“在表之外”。 我在在浏览器中运行的CDE得到这个错误:Primefaces对话框ID无法从数据表中看到
JBWEB000065: HTTP Status 500 - Cannot find component with identifier ":choice" referenced from "form:accounts:0:j_idt11".
下面是代码:
<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:p="http://primefaces.org/ui">
<h:head>
<link type="text/css" rel="stylesheet"
href="#{request.contextPath}/style.css" />
</h:head>
<h:body>
<h:form id="form">
<p:dialog header="You selected" widgetVar="dlg" id="choice" resizable="false" modal="true">
This item.
</p:dialog>
<p:layout style="min-width:400px;min-height:200px;" id="layout">
<p:layoutUnit position="center">
<p:dataTable id="accounts" var="account" value="pop" rowKey="1">
<p:column headerText="ID"></p:column>
<p:column headerText="Option">
<p:growl id="messages" />
<p:menuButton value="">
<p:menuitem value="1" update="choice" oncomplete="dlg.show()" />
<p:menuitem value="2" update="choice" oncomplete="dlg.show()" />
<p:menuitem value="3" update="choice" oncomplete="dlg.show()" />
</p:menuButton>
</p:column>
</p:dataTable>
</p:layoutUnit>
</p:layout>
</h:form>
</h:body>
</html>
更新:当我加入databale内部的对话框中,它是通过菜单按钮看出,但它要么显示不正确,要么打开,不能关闭。
可能的重复项:http://stackoverflow.com/q/8634156/870122 – perissf