【问题标题】:How to Display more than one Rich:DataTable in single page?如何在单页中显示多个 Rich:DataTable?
【发布时间】:2018-01-06 20:42:41
【问题描述】:

我想根据数据在一页中显示动态数量的丰富数据表,所以我正在做的是,在 c:foreach 循环中 ui:include 指向 datatable.xhtml.but 结果我只得到一个数据table.any 解决方案将不胜感激..

示例代码:

<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>

【问题讨论】:

    标签: jsf-2 richfaces


    【解决方案1】:

    不要使用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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-27
      • 2015-02-19
      • 2020-10-17
      相关资源
      最近更新 更多