简体   繁体   English

如何使用JSF Framework在Java中更改我的dataTable标头的背景颜色?

[英]How do i change the background-color of my dataTable header in Java using JSF Framework?

I'm using JSF 2.1 with Primefaces 4.0 on Glassfish 3.2.1. 我在Glassfish 3.2.1上将JSF 2.1与Primefaces 4.0一起使用。

In my default.css file, I have this code: 在我的default.css文件中,我有以下代码:

.facetHeaderUM .ui-datatable-header {
    background-color: transparent !important;
    border: none !important;
}

Below is the code Im using in my xhtml file. 以下是我在xhtml文件中使用的代码。

<p:dataTable id="items" var="item" value="#{EmailRcpts.listsofEmail}" 
      style="width:400px; text-align:left; font-size:12px;" 
      styleClass="facetHeaderUM"
      widgetVar="itemWidVar"
      paginator="true" paginatorPosition="bottom"
      paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" 
      currentPageReportTemplate="{totalRecords} record(s) in {totalPages} page(s)"
      rows="10">

      <f:facet name="header">
          <p:outputPanel style="font-style: italic; font-weight: bold; " >
              <p:inputText id="globalFilter" style="width:150px;margin-left: -53%" 
                  value="#{EmailRcpts.search}" /> &#160;
              <p:commandButton id="filterBtn" icon="ui-icon-search" 
                  style="font-style: italic;"/>
              <p/>
          </p:outputPanel>
      </f:facet>

In my p:dataTable I'm using styleClass=facetHeaderUM . 在我的p:dataTable中,我使用的是styleClass=facetHeaderUM I want to achieve transparent background-color and border-color in my dataTable header. 我想在dataTable标头中实现透明的background-color和border-color。

Using facetHeaderUm styleClass doesn't work. 使用facetHeaderUm styleClass不起作用。 Default background-color of my p:dataTable header which is red still reigns. 我的p:dataTable标头的默认背景色仍然是红色。

Default.css file is attached correctly. Default.css文件已正确附加。 It has many attributes and its working except to the attribute I have written above. 除了上面我写的属性外,它还有许多属性及其工作方式。

Depending on the primefaces theme you are using, I've found you also have to override the background-image property. 根据您使用的primefaces主题,我发现您还必须覆盖background-image属性。

.facetHeaderUM .ui-datatable-header {     
    background-color: transparent !important;     
    border: none !important;

    background-image: none !important; 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Ionic-如何更改整个标题的背景颜色? - Ionic - how do I change the entire header background-color? 如何在 Bootstrap 中更改手风琴选项卡的背景颜色? - How do I change the background-color of an accordion tab in Bootstrap? 即使我声明了背景颜色,我的标题也有透明背景(?),我该如何解决这个问题? - My header has a transparent background(?) even though I have declared a background-color, how do I fix this? 使用 css animation 更改背景颜色时,如何保持 state 更改? - When using css animation to alter background-color, how do I maintain the state change? 如何更改标题背景颜色? - how do I change my header background color? 如何独立于标题更改jqm滑块的背景颜色(包括实时代码) - How can I change the background-color of a jqm slider independent from the header (Live code included) 如何使用 jquery 更改导航链接的颜色或背景颜色? - How to change the color or background-color of the nav link using jquery? 当我按下另外1个div时,如何更改2 div的背景颜色? - How do I change background-color of 2 divs when I press 1 other div? 如何通过.php文件更改值的背景颜色? - How do I change the background-color of a value depending on what it is through a .php file? 如何通过设备更改背景颜色来使-webkit-backdrop-filter可用? - How do I make -webkit-backdrop-filter availability by device change background-color?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM