JSF 2: dataTable columnClasses not replicating after two columns

Im using a glass fish 3.0.1, and first experimented with columns in a dataTable.

Something like that:

<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 jsf book im master record, it says that by specifying only 2 classes in the columnClasses attribute, these 2 will be repeated when the number of columns is more than 2.

Say I have five columns, columnClasses will 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 three columns this is not the case. From the third column they did not have classes. I needed to specify columnClasses = "oddColumn, evenColumn, oddColumn" to make it work

Is this a mistake or am I only having a bad mistake?

+4
source share
1 answer

Repetition applies only to rowClasses .

From JSF 2.0 h:dataTable tag documentation :

columnClasses

A list of comma-separated sections of CSS style classes that will be applied to the columns in this table. A space-separated list of classes can also be specified for any single column. If the number of elements in this list is less than the actual number of the UIData column, for each column more than the number of elements in the list, the class attribute is not displayed. If the number of items in the list is greater than the actual number of the UIData column, the items in posisiton in the list after the last column are ignored.


rowClasses

A list of comma-separated sections of the CSS style classes that will be applied to the rows in this table. A space-separated list of classes can also be specified for any single line. Style styles are applied, in turn, to each row of the table. For example, if there are two elements in the list, the first style class in the list is applied to the first line, the second to the second, the first to the third, the second to the fourth, etc. In other words, we continue to iterate over the list until we reach the end, and then start again from the beginning.

Perhaps the book was wrong, or you read the book incorrectly.

Since the column number, as a rule, is always always fixed in the definition of the representation, there is little effort to simply 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> 
+13
source

Source: https://habr.com/ru/post/1334673/


All Articles