2011-05-30 52 views
1

我从MyClassForDatatable类对象的列表,其中JSF的DataTable Alingnement

public class MyClassForDatatable 
    public String PropertyA 
    public String PropertyB 
    public String PropertyC 
    public String PropertyD 
    //getters and setters 
    ... 

是否有可能建立一个数据表,如:

Datatable Example Image

,而不是通常的方式:

Datatable Example Image

回答

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> 

还是头一个第三方组件库,它提供colspans这样。例如,RichFaces有一个<rich:columnGroup>它应该做你想做的。

+0

非常感谢。这有助于。 – reen 2011-05-31 08:26:18

+0

不客气。 – BalusC 2011-05-31 12:09:29