PrimeFaces对话框在Chrome浏览器中不起作用 [英] PrimeFaces dialog not working in Chrome browser

查看:165
本文介绍了PrimeFaces对话框在Chrome浏览器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如您所见,我试图在单击命令链接时显示一个对话框,该对话框显示在IE和Firefox中,但未显示在Google Chrome v23中,请提出建议.

As you can see I am trying to display a dialog box on click on the command link, the dialog is displayed in IE and Firefox, but not in Google Chrome v23, please suggest.

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

推荐答案

更新对话框时,对话框将重置为默认状态,该状态为隐藏状态.如果调用dialog.show()并更新对话框,则该对话框将再次隐藏. Chrome(可能比IE或FireFox更快)似乎对此处理方式有所不同.一种解决方案是将对话框的内容包装在容器中并更新容器.

When you update the dialog the dialog is reset to the default state which is hidden. If you call dialog.show() and update the dialog the dialog is hidden again. Chrome (being probably faster than IE or FireFox) seems to handle this differently. A solution would be to wrap the content of the dialog in a container and update the container.

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

这篇关于PrimeFaces对话框在Chrome浏览器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆