Create table columns dynamically in JSF

前端 未结 1 1868
遥遥无期
遥遥无期 2020-12-01 22:22

I\'m working on dashboard application where I have to retrieve a set of records and display in dynamic tables boxes. Page frame length is fixed. now of columns and rows can

相关标签:
1条回答
  • 2020-12-01 23:11

    You can achieve this with standard JSF components using a <h:panelGrid> wherein <c:forEach> is been used to generate the cells during the view build time. The <ui:repeat> won't work as that runs during view render time.

    <h:panelGrid columns="5">
        <c:forEach items="#{bean.items}" var="item">
            <h:panelGroup>
                <h:outputText value="#{item.value}" />
            </h:panelGroup>
        </c:forEach>
    </h:panelGrid>
    

    As to component libraries, I don't see anything in OpenFaces' showcase, but PrimeFaces has a <p:dataGrid> for exactly this purpose, even with pagination support.

    <p:dataGrid columns="5" value="#{bean.items}" var="item">
        <p:column>
            <h:outputText value="#{item.value}" />
        </p:column>
    </p:dataGrid>
    
    0 讨论(0)
提交回复
热议问题