danny.lesnik
danny.lesnik

Reputation: 18639

JSF 2.1 + RichFaces 4 - Paging dataGrid

I have List<Product> products in my backEnd Bean which contains about 70 items.

I need to show it as 3 X 4 table with option to navigate between pages "next", "Previous" and option to click on page number.

How can it be done? I have no problem to use Datagrid, but how to combine it with paging?

Update: I did the following:

  <h:form>
        <rich:dataGrid value="#{productBean.products}" var="product" columns="4" id="productsList">
      <h:outputText value="#{product.sku}"/>
<f:facet name="footer">       
    </f:facet>
    </rich:dataGrid>
<rich:dataScroller for="productsList" maxPages="10"/>
   </h:form>

but my problem is that now I have a table with 4 columns and 18 rows. how Can change it to 3 rows per page?

Upvotes: 2

Views: 1632

Answers (2)

Ken Chan
Ken Chan

Reputation: 90467

Put the <rich:dataScroller> in any of the <f:facet> of the <rich:dataGrid> .

For example:

<rich:dataGrid>
        ........................
        ........................
    <f:facet name="footer">
        <rich:dataScroller/>
    </f:facet>
</rich:dataGrid>

Then , the paging control is at the bottom of the data grid.

Upvotes: 3

Kov&#225;cs Ede
Kov&#225;cs Ede

Reputation: 178

Note that the real tag looks like this:

<rich:dataScroller />

(Big S, if someone copy paste the previous example will get error!)

Upvotes: 0

Related Questions