DataTable don't reset "current page"

UI Components for JSF
Post Reply
jaideralba
Posts: 51
Joined: 06 Sep 2010, 23:01
Location: São Paulo - Brazil

30 Sep 2010, 22:34

Hi,

I'm using p:dataTable

Code: Select all

     <h:form>
           <h:outputLabel value="Id" for="input" />
           <h:inputText id="input" label="Id" value="#{myBean.id}" />

                   <p:dataTable value="#{myBean.myList}" var="item"
                                 rows="10"  paginator="true" paginatorAlwaysVisible="false">
                        <p:column>
                            <f:facet name="header">My Item</f:facet>
                            <h:outputText value="#{item.id}" />
                        </p:column>
                    </p:dataTable>

                    <h:commandButton value="Search" action="#{myBean.search}">
                        <f:ajax execute="@form" render="@form"/>
                    </h:commandButton>
When I search with id 0 (zero), to get all the results, lets supose that it retrieves 100 results. I click on the page 6, showing the results from 51 to 60, for example, and all is working fine.

Then, when I fill the id input with any number, to retrieve only one result, it's like the dataTable is still showing the page 6.

Is it an issue?

Thanks!
Mojarra 2.0.2 (FCS b10)
GlassFish 3.0.1
PrimeFaces 2.2.1

User avatar
michiel
Posts: 240
Joined: 07 Jun 2010, 09:12
Location: Belgium

01 Oct 2010, 09:20

try replacing
<h:commandButton value="Search" action="#{myBean.search}">
<f:ajax execute="@form" render="@form"/>
</h:commandButton>
by

Code: Select all

<p:commandButton value="Search" action="#{myBean.search}" process="input" update="@form">
JSF-2.0, mojarra-2.0.2-FCS and PrimeFaces-2.1 on GlassFish v3.0.1 (build 22)

jaideralba
Posts: 51
Joined: 06 Sep 2010, 23:01
Location: São Paulo - Brazil

05 Oct 2010, 17:07

Thanks michiel!

I'll try it, and later I'll post the results.
Mojarra 2.0.2 (FCS b10)
GlassFish 3.0.1
PrimeFaces 2.2.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests