[英]How to load an XHTML page into a dialog in primefaces only when the button is clicked?
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. 按下按钮时,我需要在素面的对话框中加载XHTML页面,到目前为止,我尝试将页面立即加载到主要XHTML中,而我可以使用浏览器中的视图源显示该页面,我只需要加载它即可仅在按下按钮时。
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: 还使用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. 您应该在对话框上设置dynamic="true"
属性。
Ideally, you should be launching the dialog using primefaces' Dialog Framework 理想情况下,您应该使用primefaces的Dialog Framework启动对话框
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.