Primefaces树形表针对不同层次的行使用不同的背景色 [英] Primefaces treetable different background colors for rows of different hierarchy

查看:71
本文介绍了Primefaces树形表针对不同层次的行使用不同的背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在不同的层次结构上,背景颜色是否可能会有所不同?

Is there any chance that the background colors can be different on different hierarchies?

例如,在上图中,将文档",图片",电影"的行变为绿色,并将其子级变为黄色.

For example, in the above picture, make the rows of Documents, Pictures, Movies green and their children yellow.

谢谢!

推荐答案

在您的treeNode数据中,具有诸如 String getRowStyle()之类的函数,该函数会在CSS中返回一个类.

In your data for your treeNode, have a function such as String getRowStyle() which returns a class in your css.

然后在您的xhtml中有类似的内容:

Then in your xhtml have something like:

<p:treeTable
    value="#{manager.rootNode}"
    var="treeNode"
    rowStyleClass="#{treeNode.getRowStyle()}"
    >

如果看不到效果,请清除浏览器缓存以刷新CSS.

If you don't see the effect clear your browser cache to refresh the css.

这篇关于Primefaces树形表针对不同层次的行使用不同的背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆