【问题标题】:rich:dataTable headerClass attribute issuerich:dataTable headerClass 属性问题
【发布时间】:2014-01-05 14:34:48
【问题描述】:

我们正在从 jsf 1.2 升级到 jsf 2。 我们使用的是 apache myfaces 2.1 和 rich faces 4.3。

问题是 headerClass 属性似乎不适用于 rich:dataTable。以下是xhtml代码

.class2{
 border: 1px solid #000;

}

.class1{
      text-align:left;
      color:#000;
      font-weight:normal;
}




<rich:dataTable value="#{bean.quns}" var="quns" headerClass="class1" columnClasses="class2">

                            <f:facet name="header">
                                    <h:outputText value="User Name : #{bean.userName}"/>    
                                </f:facet>

                             <rich:column>                      
                                    <h:panelGrid id="qns#{index+1}" columns="2">

                                                <h:outputText value="qns #{index+1}"/>
                                                <h:selectOneMenu value="#{quns.question}">
                                                <f:selectItems value="#{bean.questionPool}" />
                                         </h:selectOneMenu> 

                                                 <h:outputText value="Answer"/>
                                     <h:inputText value="#{quns.answer}"/>



                                            </h:panelGrid>    
                              </rich:column>
        </rich:dataTable>

columnclasses 属性运行良好。 当 Rich:dataTable 内置的 css 样式的表格标题单元格被修改如下:

.rf-dt-hdr-c{
      text-align:left;
      color:#000;
      font-weight:normal;
}

header 类工作得很好,表明默认样式表正在覆盖显式的样式表。 如何使 headerClass styleClass 起作用?

有人可以帮忙吗?

【问题讨论】:

    标签: css jsf-2 richfaces


    【解决方案1】:

    当您研究呈现的 XHTML 代码时,您会发现

    • headerClass 内容添加到标题行的tr
    • columnClassES 内容被空格标记,添加到适当的列td

    要将class1 CSS 的命令与rf-dt-hdr-c 放在同一层,只需将CSS 定义更改为

    .class1 th {
      text-align:left;
      color:#000;
      font-weight:normal;
    }
    

    希望对你有帮助...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-24
      • 2011-11-23
      • 1970-01-01
      • 2010-10-18
      • 1970-01-01
      • 2017-07-21
      • 2011-05-08
      • 2016-05-07
      相关资源
      最近更新 更多