所有。我是学习PrimeFaces的学生。按下按钮后将开始下载。此代码在生成文件期间向用户显示消息。我添加了一条弹出消息,但下载后它并没有关闭。似乎oncomplete()动作根本不起作用。请帮帮我。
<p:commandButton onclick="PrimeFaces.monitorDownload(showStatus, hideStatus)" value="Export" title="Export" ajax="false" >
<l:dataExporter source="tblResult" fileType="csv" fileName="reportCSV" fileOptions="#{contextBean.csvExportOptions}" />
</p:commandButton>
<p:confirmDialog header="Report Generation" message="Exporting" widgetVar="repGenerationDlgBtn" modal="true" >
<p:commandButton value="Ok" type="button" onclick="hideStatusWithLoading();"/>
</p:confirmDialog>
<div id="loading_image">
<p:graphicImage widgetVar="loading_image" library="images" name="loading.gif"/>
</div>
<script type="text/javascript">
function showStatus() { repGenerationDlgBtn.show(); }
function hideStatus() {
repGenerationDlgBtn.hide();
document.getElementById('loading_image').style.visibility="hidden";
}
function hideStatusWithLoading() {
repGenerationDlgBtn.hide();
document.getElementById('loading_image').style.visibility="visible";
}
</script>