简体   繁体   English

如何修改PF动态列中的数据表标题样式?

[英]How do I modify the Datatable header style in PF Dynamic Columns?

I'm trying to apply a css rule to the header of a datatable. 我正在尝试将CS​​S规则应用于数据表的标题。
The problem is that i'm using Dynamic Columns ( <p:columnS> ), and i don't know how to apply a css rule only for the header. 问题是我正在使用动态列( <p:columnS> ),并且我不知道如何仅对标题应用CSS规则。

When i try to set the style property for p:column it also change the row style. 当我尝试为p:column设置样式属性时,它也会更改行样式。

<p:columns var="a" width="40" style="text-align:center;color:red" ....>

And when i try to set only the th on the css rule, it doesn't work: 当我尝试仅在css规则上设置th时,它不起作用:

<p:columns var="a" width="40" style="text-align:center" styleClass="test" ... >

.test th {
    color:red;
}

Also, i can't just make a rule like #table th {...}, because the rules of the header style depends on each dynamic column. 另外,我不能仅仅制定#table th {...}之类的规则,因为标题样式的规则取决于每个动态列。 That would be something like: 就像这样:

<p:columns var="a" width="40" style="text-align:center" styleClass="#{a.style}" ...>

.style1{....}

Suggetions?? Suggetions?

I think you can do 我想你可以做

th[role=columnheader] {
     background-image: none;
     ....
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM