I need to load an XHTML page inside a dialog in prime-faces when the button is pressed, what i tried so far loads the page immediately inside the main XHTML that i could show using view source in the browser, i just need to load it only in button press.
Things I've tried:
<p:commandButton value="Learn More" style="float:right;"
onclick="helpDialogVar.show(); return false;" />
<p:dialog id="basicDialog" header="Learn More"
widgetVar="helpDialogVar" height="300" width="500" resizable="false"
position="right" closable="true" closeOnEscape="true" draggable="true"
>
<ui:include src="page_to_load_inside_dialog.xhtml"
</p:dialog>
Also using iframe:
<p:commandButton value="Learn More" style="float:right;"
onclick="helpDialogVar.show(); return false;" />
<p:dialog id="basicDialog" header="Learn More"
widgetVar="helpDialogVar" height="300" width="500" resizable="false"
position="right" closable="true" closeOnEscape="true" draggable="true"
onHide="jQuery('#someId').hide();" onShow="jQuery('#someId').show();">
<h:form prependId="false">
<h:outputFormat escape="false">
<iframe frameborder="0" align="left" src="page_to_load_inside_dialog.xhtml"
name="someName" id="someId" scrolling="auto" width="750"
height="500" marginheight="5" marginwidth="10">
</iframe>
</h:outputFormat>
</h:form>
</p:dialog>
any other suggestions?
You should set the dynamic="true"
attribute on the dialog.
Ideally, you should be launching the dialog using primefaces' Dialog Framework
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.