2011-05-30 53 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