0

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.

Vamsee Krishna
  • 145
  • 2
  • 11

1 Answers1

2

<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;
}
Makhiel
  • 3,874
  • 1
  • 15
  • 21
  • And what about the first row? – skuntsel May 29 '13 at 14:45
  • And how to assign a special class to the first row from within a `` tag :) ? – skuntsel May 29 '13 at 15:12
  • @skuntsel That you can't do. Do you need to? I mean there is no difference between `.row.first-row` and `.custom-first-row`, is there? – Makhiel May 30 '13 at 08:17
  • @Makhiel I see that this solution is not working in IE. I see the lines perfectly in chrome, but in IE there is not even a hint of them. Any solution? Thanks – Vamsee Krishna Jun 04 '13 at 05:22
  • Not even IE should have problems with this. Are you sure the style is not getting overwritten? (I tried it in IE8 and it works fine) – Makhiel Jun 04 '13 at 08:42