2012-12-12 62 views
0

正如您所看到的,我試圖在命令鏈接上單擊時顯示一個對話框,該對話框顯示在IE和Firefox中,但不在Google Chrome v23中,請建議。PrimeFaces對話框在Chrome瀏覽器中不起作用

<h:form id="myForm"> 
    <p:tabView id="tabView"> 
     <p:tab id="tab1" title="Tab 1"> 
      <h:panelGrid columns="1" cellpadding="10"> 
       <h:dataTable value="#{testBean.dataList}" var="data"> 
        <h:column> 
         <h:outputText value="#{data}" /> 
        </h:column> 
        <h:column> 
         <p:commandLink action="#{testBean.loadCommentHistory(data)}" 
             update=":myForm:tabView:dialog" oncomplete="dlg.show()"> 
          <h:graphicImage url="resources/theme1/images/comments.gif" 
              styleClass="basicImageStyle" /> 
         </p:commandLink> 
        </h:column> 
       </h:dataTable> 
       <p:dialog id="dialog" header="Dynamic Dialog" widgetVar="dlg"> 
        <h:outputText value="#{testBean.commentHistory}" /> 
       </p:dialog> 
      </h:panelGrid> 
     </p:tab> 
    </p:tabView> 
</h:form> 

回答

0

當您更新對話框時,對話框被重置爲隱藏的默認狀態。如果您撥打dialog.show()並更新對話框,則對話框會再次隱藏。 Chrome(可能比IE或FireFox更快)似乎可以處理這個問題。解決方案是將對話框的內容包裝在容器中並更新容器。

<p:commandLink action="#{testBean.loadCommentHistory(data)}" 
    update=":myForm:tabView:dialog-content" oncomplete="dlg.show()"> 
    <h:graphicImage url="resources/theme1/images/comments.gif" 
     styleClass="basicImageStyle" /> 
</p:commandLink> 

<p:dialog id="dialog" header="Dynamic Dialog" widgetVar="dlg"> 
    <p:outputPanel id="dialog-content"> 
     <h:outputText value="#{testBean.commentHistory}" /> 
    </p:outputPanel> 
</p:dialog> 
+0

謝謝,現在工作 –

0

如果您還沒有嘗試將頁面封裝在f:view標記中, Chrome和Safari不存在時會出現問題。請參閱http://primefaces.org/faq.html問題3

<html xmnls=... > 
    <f:view contentType="text/html"> 
     <h:head> 
      .... 
     </h:head> 
     <h:body> 
      .... 
     </h:body> 
    </f:view> 
</html> 
相關問題