簡體   English   中英

僅當單擊按鈕時,如何才能將XHTML頁面加載到素面對話框中?

[英]How to load an XHTML page into a dialog in primefaces only when the button is clicked?

按下按鈕時,我需要在素面的對話框中加載XHTML頁面,到目前為止,我嘗試將頁面立即加載到主要XHTML中,而我可以使用瀏覽器中的視圖源顯示該頁面,我只需要加載它即可僅在按下按鈕時。

我嘗試過的事情:

<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>

還使用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>

還有其他建議嗎?

您應該在對話框上設置dynamic="true"屬性。


理想情況下,您應該使用primefaces的Dialog Framework啟動對話框

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM