打开p:confirm对话框点击p:commandLink [英] Open p:confirmDialog on clicking of p:commandLink

查看:497
本文介绍了打开p:confirm对话框点击p:commandLink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在点击PrimeFace CommandLink时打开一个PrimeFace ConfirmDialog。但是当链接被点击时,对话框暂时打开,但会立即消失,我猜这个页面正在提交。这是代码:

I am trying to open a PrimeFace ConfirmDialog on clicking of a PrimeFace CommandLink. But when the link is clicked the dialog is opened for a moment but vanishes instantly, I guess the page is being submitted. Here is the code:

<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>

如何让对话框保持打开方式?

How can I make the dialog to stay opened by this way?

PrimeFace ShowCase 中,该示例涉及CommandButton和这是工作,但我的要求是使用CommandLink。

In the PrimeFace ShowCase the example deals with CommandButton and that was working but my requirement is to use CommandLink.

可以吗?任何指针都对我非常有帮助。

Is it possible? Any pointer would be very helpful to me.

推荐答案

使用

<p:commandLink value="Delete" onclick="confirmation.show();return false;"  />

<p:commandLink value="Delete" onclick="confirmation.show()" type="button"/>

这样你可以避免提交

这篇关于打开p:confirm对话框点击p:commandLink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆