简体   繁体   中英

moving from h:datatable to Grid view

I already used h:datatable to list data from a bean like:

<h:dataTable value="#{mybean.view}" var="o" border="1" >

                <h:column>
    <f:facet name="header">Name</f:facet>
                    #{o.name}
                </h:column>
                              <h:column>
    <f:facet name="header">ID</f:facet>
                    #{o.id}
                </h:column>
        </h:dataTable>

But now I want to switch to using panelgrid and apply my layout, i did this like

<h:panelGroup layout="block" styleClass="myGrid" value="#{mybean.view}" var="o">
   <h:panelGroup layout="block" styleClass="col-sm-3">
      <h:panelGroup layout="block" styleClass="griditem">


        <h:outputText styleClass="description" value="#{o.name}" />
      </h:panelGroup>
    </h:panelGroup>
</h:panelGroup>

and I get no result at all. Is it wrong to use a panel group and the place where assigned the value?

Use following sample which uses ui:repeat

<table>

<ui:repeat var="o" value="#{order.orderList}" varStatus="status">

    <tr>
        <td>#{o.orderNo}</td>
        <td>#{o.productName}</td>
        <td>#{o.price}</td>
        <td>#{o.qty}</td>
    </tr>

</ui:repeat>        

</table>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM