dataGrid PF 2.0.3

UI Components for JSF
Post Reply
dwyane
Posts: 5
Joined: 06 Jun 2010, 23:11

06 Jun 2010, 23:22

Hi. I have a problem with dataGrid.
When pagination is used, the properties values are not set correctly.
For example:

Code: Select all

<h:inputHidden id="id" value="#{userHomeBean.id}"/>

            <p:dataGrid var="item" value="#{userHomeBean.activeAnimalList}" columns="3" rows="12" paginator="true" effect="true"
            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
            rowsPerPageTemplate="9,12,15">

                <p:column>
                    <p:panel>
                        <h:graphicImage url="#{request.contextPath}/IMServlet?id=#{item.imageUrl}" width="#{userHomeBean.user.config.widthX}" height="#{userHomeBean.user.config.widthY}"/>
                    </p:panel>
                </p:column>
            </p:dataGrid>
While first GET, page is displayed properly. When pagination button is clicked, setId() is not executed.
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap() - contains <"id","test"> - pair, but setId is not executed.

Is it my problem, or bug in PrimeFaces?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Jun 2010, 12:35

It is a design decision, a pagination request should not process or know about other components on page, assume there are input fields with validation turned on. If these are processed similarly to your hiddeninput, these validations will be processed and when failed, pagination will not work.

dwyane
Posts: 5
Joined: 06 Jun 2010, 23:11

07 Jun 2010, 14:06

So, the only way to solve my problem and still to use PromeFaces is to store ID in session?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Jun 2010, 14:09

You can still get it via requestparametermap, in paging request, it will be posted.

dwyane
Posts: 5
Joined: 06 Jun 2010, 23:11

07 Jun 2010, 14:30

I know. But it is very bad and not pattern solution. Richfaces pagination allows such functionality :(

Is such design mean, that action method will not work also? For example, if I put commandButton in dataGrid.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Jun 2010, 14:50

CommandButton will work, as you can see in showcase. I couldn't understand your use-case, why do you ned that hiddeninput during pagination.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 33 guests