Page 1 of 1

DataTable don't reset "current page"

Posted: 30 Sep 2010, 22:34
by jaideralba
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!

Re: DataTable don't reset "current page"

Posted: 01 Oct 2010, 09:20
by michiel
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">

Re: DataTable don't reset "current page"

Posted: 05 Oct 2010, 17:07
by jaideralba
Thanks michiel!

I'll try it, and later I'll post the results.