JSF 2:dataTable columnClasses在两列之后不被复制 [英] JSF 2 : dataTable columnClasses is not replicated after 2 columns

查看:86
本文介绍了JSF 2:dataTable columnClasses在两列之后不被复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用Glassfish 3.0.1进行的,并且是第一次在dataTable中进行columnClasses的实验.

Im using glassfish 3.0.1 and was experimenting with columnClasses in dataTable for the first time.

是这样的:

<h:dataTable value="#{coreGridBean.heroBeanList}" var="hero"
                    captionStyle="font-size: 0.95em; font-style:italic"
                    styleClass="orders"
                    headerClass="ordersHeader"
                    footerClass="ordersHeader"
                    columnClasses="oddColumn,evenColumn">

从jsf核心核心即时阅读中可以看出,通过在columnClasses属性中仅指定2个类,当列数大于2时将重复这2个类.

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.

让我们说我有五列,columnClasses会变成oddColumn,evenColumn,oddColumn,evenColumn,oddColumn之类的东西,我们只需要这样定义它:columnClasses ="oddColumn,evenColumn"

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"

但是根据我的3列经验,并不是这样的.从第三列开始,他们没有上课.我必须指定columnClasses ="oddColumn,evenColumn,oddColumn"使其起作用

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 ?

推荐答案

重复仅适用于rowClasses.

JSF 2.0 标签文档:

columnClasses

以逗号分隔的CSS样式类列表,将应用于此表的列.也可以为任何单独的列指定用空格分隔的类列表. 如果此列表中的元素数少于UIData的实际列子级数,则不会为大于该列表中元素数的每一列输出"class"属性.列表中的元素数大于UIData的实际子列数,因此将忽略列表中最后一列之后的元素.

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.

以逗号分隔的CSS样式类列表,将应用于此表的行.也可以为任何单独的行指定用空格分隔的类列表.样式将依次应用于表中的每一行.例如,如果列表具有两个元素,则列表中的第一个样式类将应用于第一行,第二至第二行,第一至第三行,第二至第四行,等等.换句话说,我们会不断遍历列表,直到到达末尾,然后再从头开始.

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>

这篇关于JSF 2:dataTable columnClasses在两列之后不被复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆