2013-03-11 103 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