h:dataTable alternating rows in JSF2

Posted by Benchik on Stack Overflow See other posts from Stack Overflow or by Benchik
Published on 2011-01-14T12:15:36Z Indexed on 2011/01/14 15:53 UTC
Read the original article Hit count: 495

Filed under:
|
|

Hello. I'm trying to make alternating rows in JSF2 h:dataTable (no richfaces or such) but i get an unexpected result. the table is built but it has a white grid shown (but i didn't specifiy any border) and there's no buttom line under each row.

The CSS:

.order-table{   
 border-collapse:collapse;
}

.order-table-header{
 text-align:center;
 background:none repeat scroll 0 0 #E5E5E5;
 border-bottom:1px solid #95bce2;
 padding:16px;
}

.order-table-odd-row{
 text-align:center;
 background:none repeat scroll 0 0 #FFFFFFF;
 border-top:1px solid #000000;
}

.order-table-even-row{
 text-align:center;
 background:none repeat scroll 0 0 #ecf6fc;
 border-top:1px solid #BBBBBB;
}

table.order-table tr.over {
 background-color: #bcd4ec;
}

The table:

<h:dataTable id="personsTable" value="#{personController.allPersons}" var="bean" 
   styleClass="order-table" headerClass="order-table-header"
                    rowClasses="order-table-odd-row,order-table-even-row">
   <h:column>
    <f:facet name="header">
     <h:outputText value="First Name" />
    </f:facet>
    <h:outputText value="#{bean.firstName}"/>
   </h:column>
   <h:column>
    <f:facet name="header">
     <h:outputText value="Last Name" />
    </f:facet>
    <h:outputText value="#{bean.lastName}"/>
   </h:column>
   <h:column>
    <f:facet name="header">
     <h:outputText value="Phone" />
    </f:facet>
    <h:outputText value="#{bean.phone}"/>
   </h:column>
  </h:dataTable>

and a small JQuery script:

<script type="text/javascript">
   $(document).ready(function(){
    $(".order-table tr").mouseover(function(){
     $(this).addClass("over");
    });
    $(".order-table tr").mouseout(function(){
     $(this).removeClass("over");
    });
   });
  </script>

The result is (notice the white grid that came from i don't know where. And also no underline which should come from the CSS):

http://imagebin.org/132574

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css