Question

Version :

Apache MyFaces 2.1.14 RichFaces 4.3.5

Issue:

We are migrating from jsf 1.2 to jsf 2.

I have raised a similar question here regarding style sheets. The issue is the same style (as per answer in above question ) is not taking effect in anothet rich:dataTable component . Finally , the built-in richfaces style sheet worked as shown in below code. The generated html code for table header is shown also where rf-dt-shdr-c (built-in style sheet changing which solved the issue) comes into picture.

So the issue is : Why is generated html different for the same rich:dataTable components with same styles. The only change added in this rich:dataTable to that from others is the sorting behaviour like shown in below code :

Code :

<!-- 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">
Was it helpful?

Solution

You are trying to set headerClass for a table that has no header defined. Your should set the header class on columns since those are the elements with a header.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top