[英]Removing P:confirmDialog using javascript?
I have created an confirm dialog using primefaces and the coding is below. 我已经使用质数创建了一个确认对话框,并且代码如下。
<p:confirmDialog id="exportDialog" styleClass="export-dialog" rendered="#{Controller.renderExport == true}"
visible="#{Controller.renderExport == true}" header="Export" message="Do you want to export data ?"
closable="false">
<h:commandLink onclick="return closedialog()" value="Export All" action="#{Controller.exportAll}" " styleClass="export"/>
</<p:confirmDialog>
when I click the button inside dialog the dialog, it should close the dialog and an excel file excel needs to be downloaded. 当我单击对话框内的按钮时,它应该关闭对话框,并且需要下载一个excel文件。
To close the dialog i am calling the closedialog()
function. 要关闭对话框,我正在调用
closedialog()
函数。 the close dialog function is as below. 关闭对话框功能如下。
function closedialog(){
$("#exportDialog").remove();
$("#exportDialog_modal").remove();
}
the dialog box got disappeared but i am unable to click the textbox
behind the popup. 该对话框消失了,但我无法单击弹出窗口后面的
textbox
。 but i am able to click buttons. 但我能够单击按钮。 am I doing anything wrong please help.
我做错了什么,请帮忙。
Assign a 'widgetVar' to your <p:confirmDialog
like this: 为您的
<p:confirmDialog
分配一个“ widgetVar”,如下所示:
<p:confirmDialog widgetVar="myConfirm"....
Then to close it use the hide()
command in your js code like this: myConfirm.hide()
然后使用下面的js代码中的
hide()
命令关闭它: myConfirm.hide()
I took a deeper look at your question, 我更深入地研究了您的问题,
You need to replace the 您需要更换
onclick="return closedialog()"
with 同
onclick="myConfirm.hide(); return false;"
The purpose of the return false;
return false;
目的为return false;
is to prevent form submition 是为了防止表单提交
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.