Jsf 2 Rich面临dataTable头样式类问题
版本: ApacheMyFaces 2.1.14 RichFaces 4.3.5 问题: 我们正在从JSF1.2迁移到JSF2 关于样式表,我也提出了类似的问题。 问题是相同的样式(根据上述问题的答案)在Anotthet rich:dataTable组件中不起作用。 最后,内置的richfaces样式表工作如下代码所示。 生成的表格标题html代码也显示在图中Jsf 2 Rich面临dataTable头样式类问题,jsf-2,richfaces,Jsf 2,Richfaces,版本: ApacheMyFaces 2.1.14 RichFaces 4.3.5 问题: 我们正在从JSF1.2迁移到JSF2 关于样式表,我也提出了类似的问题。 问题是相同的样式(根据上述问题的答案)在Anotthet rich:dataTable组件中不起作用。 最后,内置的richfaces样式表工作如下代码所示。 生成的表格标题html代码也显示在图中rf-dt-shdr-c(解决问题的内置样式表更改) 因此,问题是: 为什么相同样式的rich:dataTable组件生成的html不同。
rf-dt-shdr-c
(解决问题的内置样式表更改)
因此,问题是:
为什么相同样式的rich:dataTable组件生成的html不同。
此rich:dataTable中添加的唯一更改是排序行为,如下代码所示:
代码:
<!-- rich faces built in style (worked )-->
.rf-dt-shdr-c{
background-image:url(../images/heading-bg.gif) !important;
background-position: left top !important;
background-color: #FFFFFF !important;
white-space:nowrap !important;
}
<!-- header class (not working ) -->
.headerClass1 {
background-image:url(../images/heading.gif);
background-color: #FFFFFF;
background-position:top left;
background-repeat:repeat-x;
}
<!-- rich dataTable with column sorting using a4j:commandLink in header -->
<rich:dataTable value="#{bean.data}" var="val" styleClass="adminTable1" headerClass="headerClass1" rows="#{bean.rowsPerPage}" rowClasses="oddRow,evenRow" render="requests" index="index">
<c:forEach items="#{items}" var="column">
<rich:column sortBy="" sortOrder="">
<f:facet name="header">
<a4j:commandLink/>
</f:facet>
</rich:column>
</c:forEach>
</rich:dataTable>
<!-- html generated for table header part for this question (rf-dt-hdr richDataTableHeader1 is missing here whereas rf-dt-shdr-c comes into play ) -->
<thead class="rf-dt-thd" id="sampleForm:req:th">
<tr class="rf-dt-shdr" id="sampleForm:req:ch">
<th class="rf-dt-shdr-c" id="sampleForm:req:j_id_1d_1_w_1" scope="col">
<!-- html generated for other rich:dataTables , -->
<thead class="rf-dt-thd" id="profForm:app:th">
<tr class="rf-dt-hdr richDataTableHeader1 rf-dt-hdr-fst" id="profForm:app:0">
<th class="rf-dt-hdr-c" id="profForm:app:j_id_67">
.rf-dt-shdr-c{
背景图片:url(../images/heading bg.gif)!重要;
背景位置:左上角!重要;
背景色:#FFFFFF!重要;
空白区:nowrap!重要;
}
.校长1{
背景图像:url(../images/heading.gif);
背景色:#FFFFFF;
背景位置:左上角;
背景重复:重复-x;
}
您正在尝试为未定义标题的表设置headerClass。您应该在列上设置header类,因为这些列是带有标题的元素。感谢repply Makhiel。我已经更新了问题,使之更加清楚。rich:dataTable确实有headerClass和styleClass属性,但它们仍然没有生效,因为headerClass没有放置的位置。表中没有
,只在列中。非常感谢Makhiel。将headerClass添加到rich:column解决了这个问题。我真的很感谢你们在富面孔问题上的帮助,我现在也很好地掌握了富面孔的风格以及它们是如何工作的。谢谢