【问题标题】:JSF Datatable AlingnementJSF 数据表对齐
【发布时间】:2011-09-04 18:15:57
【问题描述】:
我有来自 MyClassForDatatable 类的对象列表,其中
public class MyClassForDatatable
public String PropertyA
public String PropertyB
public String PropertyC
public String PropertyD
//getters and setters
...
是否可以创建像这样的数据表:
而不是通常的方式:
【问题讨论】:
标签:
java
jsf
datatable
jsf-2
【解决方案1】:
那么,你想要colspan?这在标准 JSF 组件库中不受支持。
要么使用普通的 HTML
<table>
<tr>
<th>Header1</th>
<th>Header2</th>
<th>Header3</th>
</tr>
<ui:repeat value="#{bean.list}" var="item">
<tr>
<td>#{item.propertyA}</td>
<td>#{item.propertyB}</td>
<td>#{item.propertyC}</td>
</tr>
<tr>
<td colspan="3">#{item.propertyD}</td>
</tr>
</ui:repeat>
</table>
或者前往提供类似 colspan 的 3rd 方组件库。例如,RichFaces 有一个 <rich:columnGroup>,它应该可以满足您的需求。