jsfdatatablerichfacesrichdatatable

Add lines between the rows of a rich:dataTable


How can I add lines between the rows of a dataTable in JSF - so the table looks something like a matrix ?

Below is my view file :

<rich:dataTable value="#{myController.myModel}" var="myManager" id="managerTable" >

A quick search pointed that adding rules="rows" in the dataTable would work. I tried but with no result. Apparently, when I add rules="rows" for a h:dataTable, there are lines that are introduced between the rows.

<h:dataTable value="#{myController.myModel}" rules="rows" var="myManager" id="managerTable" >

But it fails the moment I change to rich:dataTable.

How can I obtain the same result in rich:dataTable too?

I use JSF 2.0 and richfaces 4.


Solution

  • <rich:dataTable> has rowClass attribute, if you want lines between rows you can make a CSS class like this one:

    .row-line {
        border-bottom: 2px solid black;
    }
    

    EDIT: The first row in a dataTable has the rf-dt-fst-r class. So in case you'd want to add a line above the table:

    .row-line.rf-dt-fst-r {
        border-top: 2px solid black;
    }