2013-03-11 102 views
0

我正在使用primefaces對話框用於彈出目的。但每次它被打開時,整個屏幕會自動刷新並彈出消失。Primefaces對話框彈出窗口刷新背景並消失

< p:dialog id="dialog" header="Select different user" styleClass="atf-header"   widgetVar="dlg" appendToBody="true"> 
    <ui:include src="searchpopup.xhtml" /> 
     </p:dialog> 
    <h:panelGroup> 
    <h:outputLabel value="#{I18N['Create_Ticket_for_other_users']}" styleClass="atf-header" style="width:600px"></h:outputLabel> 
    </h:panelGroup> 
    <h:panelGroup id="search_section" layout="block" 
     styleClass="atf-content-area atf-separarot-botton" style="width:600px"> 
     <h:panelGroup id="input_search_section" > 
      <h:outputText id="name" value="Siddharth Mishra"  
      labelStyleClass="atf-label"> 
      </h:outputText> 
     </h:panelGroup> 
    <h:panelGroup styleClass="atf-right atf-inline-block"> 
     <p:commandButton id="btn_search" value="select different user" 
      styleClass="atf-button-search" onclick="dlg.show()"> 
     </p:commandButton> 
    </h:panelGroup> 
</h:panelGroup> 
+0

嗨Cyd。如果你創建沒有'ui:include'的'p:dialog'會發生什麼?嘗試通過將所有內容包含在對話框中來創建對話框。同時發佈'ui:include'中的代碼。 – 2013-03-11 10:13:41

回答

2

p:commandButton是AJAX按鈕(這是默認primefaces)它提交整個表單。將type="button"屬性添加到它,所以它將只是一個普通的按鈕,它執行一些JavaScript(所謂的按鈕)。我也看不到h:form標籤在這裏。因爲你有appendToBody="true"p:dialog岸上,你不包封p:dialog裏面h:form。如果有必要,您應該在p:dialog內部有h:form,並且如果它不在h:form之外移動p:dialog

+0

Bingo!..謝謝你的回答是,那是原因.. :-) – Cyd 2013-03-11 10:50:52