【发布时间】:2012-11-15 10:43:45
【问题描述】:
我试图在单击 PrimeFace CommandLink 时打开 PrimeFace ConfirmDialog。但是当点击链接时,对话框会打开一会儿但立即消失,我猜页面正在被提交。代码如下:
<p:commandLink value="Delete" onclick="confirmation.show()" />
<p:confirmDialog message="Are you sure, you want to delete ?" header="Initiating deleting process" widgetVar="confirmation">
<p:commandButton value="Yes Sure" onclick="confirmation.hide()" actionListener="#{adminCtrl.deleteUserById}" update="userData" >
<f:attribute name="delete" value="#{user.userId}" />
</p:commandButton>
<p:commandButton value="Not Yet" onclick="confirmation.hide()" type="button" />
</p:confirmDialog>
我怎样才能让对话框以这种方式保持打开状态?
在PrimeFace ShowCase 中,该示例处理 CommandButton 并且可以正常工作,但我的要求是使用 CommandLink。
有可能吗?任何指针都会对我很有帮助。
【问题讨论】:
-
您的 code-sn-p 对我有用 .. 错误可能在其他地方?
-
可能是 JS 错误。阅读浏览器 JS 控制台以获取线索。顺便说一句,在此构造中完全不需要命令链接(假设您没有过度简化代码)。只需使用普通链接即可。
标签: java jsf dialog primefaces commandlink