5

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 be initialized. It should look like this sample:

enter image description here

Currently I'm using data table to display but it prints all the data in one column. How would I change my code to above pattern?

<o:dataTable id="tabBlSearch" var="item"
     onkeyup="handleLeftRightArrowOnDataTable('frmDashBoard:tabBlSearch')"
     value="#{bLDashBoardAction.listBondLoc}">
  <o:column style="width: 20px;">
    <h:outputText value="#{item.awb}" />
  </o:column>
</o:dataTable>

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.