css - 如何将样式应用于 PrimeFaces 数据表?

标签 css jsf jsf-2 primefaces datatable

最初,我有一个 JSF 数据表 2.0,如下所示:

<h:dataTable value="#{bean.items}" var="item" styleClass="table table-hover">

看起来像这样:

Before use PrimeFaces DataTable (I need discover what's the selected row

我想使用行选择,所以我切换到 PrimeFaces 4.0 数据表:

<p:dataTable value="#{bean.items}" var="item" styleClass="table table-hover"
    rowKey="#{item.id}" selection="#{bean.selectedItem}" selectionMode="single">

看起来像这样:

After use Primefaces (but can't discover the selected row yet :(

但是,我的样式类 tabletable-hover 没有被应用。这是怎么引起的,我该如何解决?

最佳答案

获取您的 Primefaces 版本的 Primefaces 用户指南 here .
在该文档中,您将找到如何在 Skinning 标题下覆盖每个组件的样式。
例如:
以下是 p:outputLabel

的皮肤

enter image description here

如果您想更改颜色,我会使用我的 css,因为它适用于所有 p:outputLabel

.ui-outputlabel{
color:blue;
}   

如果你只想改变一个特定的p:outputLabel的样式,你可以像这样使用

<div class="myLabel">
   <p:outputLabel value="This is Demo" />
</div>

那么 CSS 会是这样的:

.myLabel .ui-outputlabel{
    color:blue;
}

关于css - 如何将样式应用于 PrimeFaces 数据表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19719614/

相关文章:

javascript - Firefox 中的图像交换

MySQL + JSF 2 登录过滤器

java - JSF 的安全问题是什么?

java - Primefaces 登录应用程序

java - 创建自己的标签时嵌套 EL 表达式

css - 粘性页脚 : Why is :after needed?

html - css 不透明度不起作用

css - Sencha Touch 2 CSS 不工作

Spring session bean 将 FacesContext.getCurrentInstance() 视为 Null 引用

java - 如何填充 richfaces 选择列表的右侧?