如何在 rich:datatable
中设置 rich:column
的列宽? width
属性被忽略。见以下代码:
<rich:column label="#{msg[result]}" width="150px">
<f:facet name="header">
<h:outputText value="#{veryLongText}"/>
</f:facet>
<h:outputText value="#{someValue}" />
<f:facet name="footer">
<h:outputText value="#{someValue}" />
</f:facet>
</rich:column>
如果您呈现此列并且 veryLongText
宽度超过 150px,则不会将其分成多行。相反,它只是忽略列宽并占用所需的空间。
如何解决这个问题?
最佳答案
试试 <rich:column>
的 headerClass
属性,因此:
<rich:column headerClass="myWidth">
...
</rich:column>
然后,在您的 CSS 中(嵌入或链接):
.myWidth {width:150px}
您可能还会在某处使用一些违反规定的“空白”CSS 属性,因此您可能需要指定 .myWidth
选择器如此:
.myWidth {width:150px; white-space:normal!important}
关于css - rich 中的列宽 :datatable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3512682/