java - Primefaces 确认对话框在使用 ajax 更新的表单中未垂直居中

标签 java html jsf primefaces

我有一个表单,当单击某些操作时,它会通过 Ajax+Rendered“增长”。问题是当表单增长时我的 p:confirmDialog 没有垂直居中。当处于“正常大小”时,对话框正确居中。

我已经尝试过:

  • 删除或添加“appendToBody”属性
  • 更改页面中声明的位置(h:form 之前和之后)
  • 覆盖 CSS 中的“顶部”

这是 Primefaces 的问题(当前使用 v4)还是我做错了什么?由于我使用了很多“渲染”属性,我应该“重新渲染”对话框吗?

下面是我的代码片段。

<h:form id="myForm">            
    <p:fieldset legend="Hello">
        <!-- lots of things here -->
    </p:fieldset>
    <p:spacer height="20px" />
    <p:fieldset legend="Dashboard" 
        id="thisOneMakesTheFormGrows" 
        rendered="#{bean.include or bean.edit}">
        <!-- this one has lots of items, making the page grow when the 'rendered' attribute is true -->
    </p:fieldset>
</h:form>           

<p:confirmDialog global="true"
    id="meuConfirmDlg"
    appendToBody="true"
    showEffect="fade"
    width="500px" 
    hideEffect="fade"
    widgetVar="confirmDlg"
    closable="false">
    <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
    <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>

最佳答案

您是否按百分比覆盖了对话框的 TOP 属性?如果没有请覆盖​​对话框div的css。

#dialogBoxId{
 top: 50% !important;
 left:50% !important;
}

关于java - Primefaces 确认对话框在使用 ajax 更新的表单中未垂直居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26740262/

相关文章:

php - 创建一种从 JSON 日期时间搜索日期范围的方法

css - 减少 UI 控件之间的空间

html - 布局后让同位素调整容器的高度

java - 如何覆盖冰:commandLink css

java - Appengine 缓慢

java - JSF 和 Richfaces 丰富 :select and f:selectItems

java - 如何使用外部 jar 执行 java 程序

java - "readonly if parameter"在 thymeleaf 中不起作用

java - 将 Java 对象设置为 null 还会有什么作用吗?

jsf - 警告 : JSF1074: Managed bean named 'bean' has already been registered