【问题标题】:JSF RichFaces:a4jSkin.tableBackgroundColor behaviour for zebra tableJSF RichFaces:斑马表的a4jSkin.tableBackgroundColor 行为
【发布时间】:2011-04-12 12:51:22
【问题描述】:

jsf:

<rich:dataTable id="files" styleClass="table" headerClass="header"
value="#{file}" var="fileRecord" rendered="#{file.rowCount>0}"
rowClasses="even,odd" onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
<rich:column>

前提条件:
有带白色和灰色行的斑马样式表
步骤:
1.鼠标悬停在行上,悬停正常
2.鼠标移开,变成白色

后置条件: 表失去了“斑马”

发生这种情况是因为 #{a4jSkin.tableBackgroundColor} 评估为白色。
如何保持斑马造型?

感谢您的帮助。

【问题讨论】:

    标签: jsf richfaces mouseover zebra-striping


    【解决方案1】:

    应该改为:

    #{a4jSkin.rowBackgroundColor}
    

    【讨论】:

      【解决方案2】:
      <rich:dataTable id="files" styleClass="table" headerClass="header"
        value="#{file}" var="fileRecord" rendered="#{file.rowCount lt 0}"
        rowClasses="even,odd" 
        onRowMouseOver="tableRowColor=this.style.backgroundColor;
          this.style.backgroundColor='#dedede'"
        onRowMouseOut="this.style.backgroundColor=tableRowColor">
      <rich:column>
      

      【讨论】:

      • 你能解释一下为什么这会起作用吗?我了解onRowMouseOut 表格的背景颜色将更改为(未定义的)“tableRowColor”变量?
      • 当检测到 mouseOver 时,它将当前的 backgroundColor 保存在名为 tableRowColor 的变量中,然后分配颜色#dedede。当鼠标离开时,它分配存储在 tableRowColor 变量中的样式。它现在对我有用。
      • 我仍然不认为像这样依赖全局变量是一个好主意(阅读:一个可怕的黑客),但我知道你在追求什么。
      猜你喜欢
      • 2012-06-01
      • 1970-01-01
      • 2017-10-20
      • 2012-09-06
      • 1970-01-01
      • 2011-04-04
      • 1970-01-01
      • 2017-06-24
      • 1970-01-01
      相关资源
      最近更新 更多