css - Primefaces:具有不同颜色的 CheckBoxMenu

标签 css jsf primefaces

我想在 <p:selectCheckboxMenu> 中显示 selectItems有不同的颜色或背景,我该怎么做?有人知道吗?谢谢。

<p:selectCheckboxMenu id="testresultfilter"  value="#{testrunBean.selectedFilterResult}" filter="true" label="Execution Status" immediate="true"  valueChangeListener="#{testrunBean.handleResultChange}" style="vertical-align:middle;"  panelStyle="width:220px;" onchange="executeStatusOnChange();">           
   <f:selectItems value="#{testrunBean.validResults}" />                                 
</p:selectCheckboxMenu >

最佳答案

是的,在 css 的帮助下。

CSS

.ui-selectcheckboxmenu-panel .ui-selectcheckboxmenu-list-item:nth-child(3) {
  color: aqua;
  background: #ff00ff;
}

.ui-selectcheckboxmenu-panel .ui-selectcheckboxmenu-list-item:nth-child(2) {
  color: blue;
  background: #ffff00;
}

.ui-selectcheckboxmenu-panel .ui-selectcheckboxmenu-list-item:nth-child(1) {
  color: green;
  background: #ff0000;
}

关于css - Primefaces:具有不同颜色的 CheckBoxMenu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24424771/

相关文章:

javascript - 在 css3 中使用百分比创建预加载器

css - 当我改变它的高度时面板标题覆盖网格 - ExtJS

html - 更改包裹在 <a> 中的悬停元素符号颜色

jsf - Primefaces 与 Gallery Film strip 的 UI 问题

css - 如何在 Primefaces 数据表中显示图标而不是数据?

jsf - Primefaces 消息用于验证,其余部分则咆哮

c# - 非静态字段、方法或属性需要对象引用 'MyClass.SetImageUrl()'

ajax - 为什么 FullAjaxExceptionHandler 不简单地执行 ExternalContext#redirect()?

java - 从 GenericFacesPortlet 获取 session 范围的 bean

jsf - 何时在 JSF 中命名转换器