A customer contacted me with the following problem:
he created an ADF Faces page where
the end-users can enter a query criterion, say a Department Number, and display
the Employees from this Department in a Read-Only Table. 
The application works fine.
However, they reported the following problem:
they can navigate to another Range in the page, to scroll through the employees of the department, as shown in the figure above, where the second Range (record 3) is displayed (I set the RangeSize to 2 in this sample).
Then they query another department, say 20.
Employees from this Department are shown - that's correct.
However, they were expecting the table to show the first employees of the Department 20.
It doesn't: the table Range stayed at the same position as it was before the new query was executed:
To fix this problem, you have to add the following code in your backing bean:
public String resetRange() {where table.setFirst(0) sets the index of the first row in the currently range of rows to the first record in the Table.
getEmpTable().setFirst(0);
return null;
}
and set the property action of your commandButton to call this code:
<af:commandButton
text="Query"
(...)
action="#{yourBackingBean.resetRange}"/>
I've added example # 4 in my Sample Applications page. It includes a page showing the problem, and another one including the workaround.
Comments (3)
Thanks a lot, it really help me. :-)
Posted by guddu | October 16, 2007 3:41 AM
Posted on October 16, 2007 03:41
Thank you so much for your help! It fixed my issue.
Happy holiday!
Posted by Cindy | December 19, 2008 5:17 AM
Posted on December 19, 2008 05:17
Thanks for the feedback Cindy
Posted by Didier | December 20, 2008 1:15 AM
Posted on December 20, 2008 01:15