You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Travis Reeder <tr...@gmail.com> on 2006/03/22 02:02:52 UTC

Resetting DataScroller

I am filtering the data in a datatable so the backing datamodel shrinks, but
if a user has already paged past the first page and the size of the data is
less then a single page, it appears that the datascroller stays on the
second (or later) page.

For example, there are 15 items in the data model at first and we're showing
10 per page.  Then the user clicks to the second page to see the last 5
items.  Now if the user then searches at that point and the the result set
is only say size 1, the list will be empty because it is still on page 2.
If you click back a page, you'll see the item.

I have preserveDataModel="false" on the datatable.

Is there any trick to this that I might have missed?

Here's the definitions:

<x:dataTable
        id="xTable"
        binding="#{xBean.aTable}"
        value="#{xBean.y}"
        var="x"
        sortColumn="#{xBean.xListSortColumn}"
        sortAscending="#{xBean.xListSortAscending}"
        rowIndexVar="rowIndex"
        rowCountVar="rowCount"
        rows="#{xBean.numRowsPerPage}"
        preserveDataModel="false"
        >

 <x:dataScroller id="scroll_1"
                    for="xTable"
                    fastStep="10"
                    pageCountVar="pageCount"
                    pageIndexVar="pageIndex"
                    styleClass="scroller"
                    paginator="true"
                    paginatorMaxPages="9"
                    paginatorTableClass="paginator"
                    paginatorActiveColumnStyle="font-weight:bold;"
                    immediate="false"
                    binding="#{xBean.dataScroller}">


Travis

Re: Resetting DataScroller

Posted by Greg <de...@gmail.com>.
Your search field would probably need a valueChangeListener method
which if residing in xBean then whatever xBean.aTable is returning,
i.e. the IUData component, then can set the first row to be shown as
zero, i.e. UIData.setFirst(0);

I'd be interested to know how many times per request the db query is
being executed for your table data, given that you're also sorting on
the columns, from what I've gone through, your question about reseting
the row index would of been needed to prevent duplicate queries when
sorting the dataTable ? Also, Is your xBean in the session or request
scope ?