将样式应用于p中的标题:datatable [英] Applying styles to Header in p:datatable
问题描述
我想知道如何应用头文件中的数据类型。我能够使用rowStyleClass属性更改行的样式。但不知道,如何改变标题列的样式。示例示例将非常有用。我已经尝试了下面,但整个列的样式似乎改变了
I would like to know how to apply the styles for the header column in the primefaces Datatable. I was able to change the styles for the rows using the rowStyleClass attribute. But not sure, how to change the style for the header columns. A sample example would be really helpful. I have tried the below, but the style for the entire column seems to get changed
<p:column id="SelectallID" headerText="Select ID" style="text-align:center; background-color:#C6C3C6;padding:12px;">
<h:outputText>
<h:selectBooleanCheckbox id="checkbox2" value="#{car.selected}"/>
</h:outputText>
</p:column>
当我使用上面的时候,整个列风格似乎都会改变。但我想改变只有标题列的样式。请协助。
when I use the above, the entire column style seems to get changed. But I want to change the style for only the header columns. Please Assist. Thanks in Advance.
推荐答案
Primefaces数据表头生成一个html < th>
元素。您可以在样式定义中使用元素选择器:
Primefaces datatable headers generate a html <th>
element. You could use an element selector in your style definition:
th {
color: red !important;
}
这将会改变所有 < th>
页面上的元素。
This will for instance change the font color of all <th>
elements on the page.
如果此选择不够针对您的目的,您可以将其与数据表:
If this selection is not specific enough for your purposes, you can combine it with the id of the datatable:
#review-table th {
color: red;
}
这篇关于将样式应用于p中的标题:datatable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!