输入长文本时如何防止表格拉伸(stretch):
屏幕: http://zapodaj.net/71821572f2445.jpg.html
Meyby 是否可以使文本行水平拉伸(stretch)行?
我的片段示例表:
<p:dataTable id="table" styleClass="table" value="#{userMB.allInactive}" var="inactive" paginator="true" rows="15" rowKey="#{inactive.id}" selection="#{userMB.user}" selectionMode="single" >
<f:facet name="header">
Lista kont nieaktywnych
</f:facet>
<p:column headerText="#{msg.firstName}">
<h:outputText value="#{inactive.firstName}" />
</p:column>
我试过了 <p:column headerText="#{msg.firstName}" width="20px">
列的样式类:<p:column styleClass="column" headerText="#{msg.firstName}" width="20px">
.column {
width: 20px;
}
但我没有看到任何变化,它不起作用。
最佳答案
CSS 是你的 friend ,在你的情况下:
overflow: hidden;
word-wrap: break-word;
您应该在表格单元格内的元素上设置它们。如果设置width
,单元格将被水平裁剪(不拉伸(stretch),无论字长多少,字都会被打断)。如果您还设置了 max-height
,该线将不会垂直拉伸(stretch)到您设置的限制之上。
请参阅 jsfiddle:http://jsfiddle.net/9EuRZ/1/
关于java - 在 Primefaces 中拉伸(stretch)列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17409123/