【问题标题】:JSF Primefaces ConfirmDialogJSF Primefaces 确认对话框
【发布时间】:2014-04-08 09:09:18
【问题描述】:

我正在改进/优化我的 primefaces ConfirmDialog,但我似乎无法在其上放置一些漂亮的图像或改进它的某些外观。此外,我似乎找不到一些关于如何使用其属性的文档,我已经下载了 primefaces 用户手册,但它似乎缺少一些东西。 这是我的代码。

<p:confirmDialog header="Confirm" severity="alert" closeOnEscape="true" widgetVar="confirmationDialog" showEffect="fold" >
    <f:facet name="message">
          <h:outputText value="Are you sure all details 
                           are correct and proceed in creating the Account?" />        
    </f:facet>
    <p:commandButton value="Yes" actionListener="#{marketingPersonController.create}" 
                     oncomplete="confirmationDialog.hide()" icon="ui-icon-check"
                     update="propertyPanel accountPanel marketingPersonPanel">
         <f:ajax rendered="propertyPanel accountPanel marketingPersonPanel"/>
    </p:commandButton>

    <p:commandButton value="No" onclick="confirmationDialog.hide()" type="button" 
                     icon="ui-icon-close"/>
</p:confirmDialog>

这是截图

我似乎无法删除小的!那里的图标,如果我没有设置严重性,它仍然会显示一个奇怪的“^”图像。我想彻底改变图标并以某种方式修改它的一些外观。

另外,我尝试使用这个 css。仍然无法正常工作。

  .ui-dialog-content p span { 
            background-image: url('path to image here')
               no-repeat !important;
  }

我做错了吗?如果您有完整的 primefaces 文档,那也会有所帮助。谢谢

【问题讨论】:

    标签: css jsf jsf-2 primefaces xhtml


    【解决方案1】:

    你有两种可能:

    您可以像这样直接替换覆盖 Primefaces CSS 的图标:

    CSS

    .ui-icon.ui-confirm-dialog-severity {
        background-position: 0 0 !important; 
        background-image: url('PATH TO IMAGE HERE') !important;
    }
    

    或者你可以这样做:在触发对话框的组件内部:

    XHTML

     <p:confirm header="HEADER" message="MESSAGE" icon="ui-icon-alert" />
    

    此处示例:http://www.primefaces.org/showcase/ui/confirmDialog.jsf

    CSS

    .ui-icon.ui-confirm-dialog-severity.ui-icon-alert {
        background-position: 0 0 !important; 
        background-image: url('PATH TO IMAGE HERE') !important;
    }
    

    【讨论】:

    • 我尝试了第一个 CSS 解决方案,它成功了。谢谢!另外,有没有办法可以修改标题,也许可以在其中添加一些颜色
    猜你喜欢
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 2017-09-07
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多