Table Range Not Reset After Query


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.

Dept10_Range2:


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:

Dept20_Range2:


To fix this problem, you have to add the following code in your backing bean:

public String resetRange() {
   getEmpTable().setFirst(0);
   return null;
}
where table.setFirst(0) sets the index of the first row in the currently range of rows to the first record in the Table.

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:

Thanks a lot, it really help me. :-)

Posted by guddu on October 15, 2007 at 08:41 PM CEST #

Thank you so much for your help! It fixed my issue. Happy holiday!

Posted by Cindy on December 18, 2008 at 09:17 PM CET #

Thanks for the feedback Cindy

Posted by Didier on December 19, 2008 at 05:15 PM CET #

Post a Comment:
Comments are closed for this entry.
About

Didier Laurent - Sr Principal Support Engineer in the JDeveloper team

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today