0

) 我在使用 primefaces 主题时遇到了一个问题...我有一个 XHTML 页面包含一个数据表,其中包含根据条件着色的线条。但是在集成主题“trontastic”之后一切都丢失了......我必须做什么!帮帮我这个我的代码根据条件不显示这种风格

<p:dataTable var="fab" value="#{composantbean.list}" 
   rowStyleClass="#{fab.statut eq 'Actif' ? 'a'  : (fab.statut eq 'Obsolete' ? 'o':(fab.statut eq 'En voi d obsolescence' ? 'e':(fab.statut eq 'Obsolete mais diponible' ? 'or':null)))}">  

这是风格不接受!

<h:head><style type="text/css">

.a
{
background-color: #00FF00 !important;
      font-weight: bold;
}
.o
{
background-color: #FF0000 !important;
      font-weight: bold;
}
.e
{
background-color: #FFFF00 !important;
      font-weight: bold;
}
.or
{
background-color: #FF9933 !important;
      font-weight: bold;
}
</style>
4

2 回答 2

1

我们这里有两个问题:

  1. 打开萤火虫,我们可以看到背景分配给背景css 属性,而不是像在 primefaces 示例和您的代码中那样的背景颜色。因此,将每个背景颜色替换为背景。
  2. 我们可以注意到自定义颜色恢复后高亮行颜色丢失。要修复它,打开 firebug 并在 CSS .ui-state-highlight中找到并添加重要的,对于下班后的主题,它看起来像:

.ui-state-highlight {

 background: linear-gradient(#FFFFFF, #CCEEFF)
 repeat scroll 0 0 rgba(0, 0, 0, 0) !important;

}

于 2013-10-08T13:50:26.517 回答
1

根据您的浏览器,使用萤火虫或其他任何东西检查您的数据表元素。我假设 primefaces 主题将某些 css 类附加到那里的组件。如果要编辑样式,则需要创建基于这些样式的 css 类。

默认情况下,css 类将是.ui-component

尝试将您的 css 类编辑为.ui-component .o 等等...

请记住 .ui-component 可以是任何东西,因此请使用 firefox 中的 firebug 或仅使用 chrome 中的 devloper 工具 (cntrl shift i ) 来检查元素 css 类。

于 2013-04-23T20:42:40.817 回答