Im using glassfish 3.0.1 and was experimenting with columnClasses in dataTable for the first time.
It's something like this :
<h:dataTable value="#{coreGridBean.heroBeanList}" var="hero"
captionStyle="font-size: 0.95em; font-style:italic"
styleClass="orders"
headerClass="ordersHeader"
footerClass="ordersHeader"
columnClasses="oddColumn,evenColumn">
From the core jsf book im reading, it says that by specifying only 2 classes in the columnClasses attribute, those 2 will be repeated when the column amount is more than 2.
Let's say that i have five columns, the columnClasses would become something like oddColumn,evenColumn,oddColumn,evenColumn,oddColumn, and we just need to define it like this : columnClasses="oddColumn,evenColumn"
But in my experience with 3 columns, it's not like this. From the third column they got no classes. I had to specify columnClasses="oddColumn,evenColumn,oddColumn" to make it work
Is this a bug or i just have a bad error ?
The repetition only applies on rowClasses
.
From the JSF 2.0 h:dataTable
tag documentation:
columnClasses
Comma-delimited list of CSS style classes that will be applied to the columns of this table. A space separated list of classes may also be specified for any individual column. If the number of elements in this list is less than the number of actual column children of the UIData, no "class" attribute is output for each column greater than the number of elements in the list. If the number of elements in the list is greater than the number of actual column children of the UIData, the elements at the posisiton in the list after the last column are ignored.
rowClasses
Comma-delimited list of CSS style classes that will be applied to the rows of this table. A space separated list of classes may also be specified for any individual row. Thes styles are applied, in turn, to each row in the table. For example, if the list has two elements, the first style class in the list is applied to the first row, the second to the second row, the first to the third row, the second to the fourth row, etc. In other words, we keep iterating through the list until we reach the end, and then we start at the beginning again.
Maybe the book was wrong, or you misread the book.
Since the column number is usually always fixed in the view definition anyway, it's little effort to just repeat them yourself.
<h:dataTable columnClasses="oddColumn,evenColumn,oddColumn,evenColumn">
<h:column></h:column>
<h:column></h:column>
<h:column></h:column>
<h:column></h:column>
</h:dataTable>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With