Primefaces对话框弹出窗口刷新背景并消失

时间:2013-03-11 10:01:35

标签: jsf 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>

1 个答案:

答案 0 :(得分:2)

p:commandButton是AJAX按钮(在primefaces中是默认的),它提交整个表单。添加type="button"属性,以便它只是普通按钮,它可以执行一些JavaScript(所谓的按钮)。此外,我在这里看不到h:form标记的位置。如果你appendToBody="true"中有p:dialog,请不要将p:dialog封装在h:form内。如果有必要,您应该在h:formp:dialog,如果p:dialog之外没有移动h:form

相关问题