Hi All,
I am using JDeveloper 12.2.1.4 .
My scenario is,
I have popup with <af:fileDownloadActionListener> component when user clicks the download button it will trigger the file download listiner and download the text docuemnt.
Download is working fine but after the download I tried to close the popup but I'm not able to close the popup.
My JSPX codes,
<af:commandButton text="DwonLoadPopup" id="cb2">
<af:showPopupBehavior popupId="p1" triggerType="action"/>
</af:commandButton>
<af:popup id="p1">
<af:dialog id="pgl2" resize="on" title="Downloadpopup">
<af:panelGroupLayout id="pgl3">
<af:commandButton text="Download" id="cb1">
<af:fileDownloadActionListener method="#{bean.doDownload}"
contentType="pdf"
filename="sample.pdf"/>
</af:commandButton>
</af:panelGroupLayout>
</af:dialog>
</af:popup>
Java Codes:
public void doDownload(FacesContext facesContext, OutputStream outputStream)
{
String data = "Download my contents";
try
{
OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
writer.write(data);
writer.close();
outputStream.close();
}
catch(IOException e)
{
e.printStackTrace();
}
RichPopup pop =(RichPopup)facesContext.getCurrentInstance().getViewRoot().findComponent("p1");
pop.cancel();
}
Additionally I've used java script to hide my popup, but all went in vain.
Any suggestions will be appreciated.
Regards,
Radheshyam.