Binding will work, just make sure you bind at the request scope.
As for making sure your UIData object is not re-used for each query,
the easiest way is probably to ensure the view is re-created. Just
make sure your query is an action method and that you always navigate
on the result. If you want to stay on the same page you could just
navigate to the current view (the view will be created).
The other alternative is to extend the HtmlDataModel and make sure the
"first" is always an EL expression. This is what I did in a similar
problem. I made it so this specific data model sets the ValueBinding
value if the ValueBinding is not null. I presented this in the "Making
sure DataTable's first always uses EL [was] Re: Facelets 1.0.14 causes
duplicate IDs..." thread (April 17).
Here are the steps if you choose the last method (from the above thread):
1) create a new class that extends
org.apache.myfaces.component.html.ext.HtmlDataTable
2) Override setFirst:
@Override
public void setFirst(int first)
{
ValueBinding vb = getValueBinding("first");
if (vb != null)
{
vb.setValue(getFacesContext(), first);
return;
}
else
super.setFirst(first);
}
3) created a new tag in my taglib.xml file (this is because I don't
want all tables to behave this way)
4) set the new tag's component type to a new type
5) registered the new tag's component type in my faces-config.xml to
point to the new component
-Andrew
On 4/21/06, fischman_98 <[EMAIL PROTECTED]> wrote:
>
> So I need to bind the dataScroller to the bean and call the .setFirst(1)
> prior to each query?
>
> As for the other way, How can you make sure the same UIData object is not
> re-used for each query?
>
> Many thanks.
> --
> View this message in context:
> http://www.nabble.com/Clear-%28Reset%29-dataTable-%28w-dataScroller%29-on-new-Query-t1488705.html#a4034540
> Sent from the MyFaces - Users forum at Nabble.com.
>
>