2017-07-31 67 views
0

我想基於數據在一頁中顯示豐富的數據表的動態數量,所以我正在做的是,在c:foreach循環ui:包括哪些指向datatable.xhtml.but因爲我只得到一個數據表.ANY溶液可以理解..如何在單個頁面中顯示多個Rich:DataTable?

示例代碼:

<c:forEach items="#{bean.list}" var="item"> 
<ui:include src="/dataTable.xhtml" > 
<ui:param name="values" value="#{item.value}" /> 
<ui:param name="some other values" value="#{item.key}" /> 
</ui:include> 
</c:forEach> 

回答

0

不要使用c:forEach,使用JSF組件循環代替。例如rich:dataGrid

<rich:dataGrid columns="3" var="res" value="#{chProfile.clubItems}"> 
    <h:panelGroup layout="block" style="width:300px;"> 
     <rich:dataTable style="width: 100%"> 
      <rich:column id="item"> 
       <f:facet name="header"> 
        <h:outputText value="#{res.promoName} Club" /> 
       </f:facet> 
      </rich:column> 
     </rich:dataTable> 
     <h:outputText value="#{res.freeItemsReceived} free #{res.freeItemsReceived == 1 ? 'item' : 'items'} received during this calendar month" /><br /> 
    </h:panelGroup> 
</rich:dataGrid> 

其它替代可以是ui:repeat

<ui:repeat var="state" value="#{referenceLists.USstates}"> 
    <ui:fragment rendered="#{reportForm.isChStateSelected(state.value)}"> 
     <h:outputText value="#{state.label}" /><br /> 
    </ui:fragment> 
</ui:repeat> 
相關問題