« Firefox Extensions | Main | JDeveloper 10.1.3.2 (WebCenter) Production »

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 (3)

guddu:

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

Cindy:

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

Thanks for the feedback Cindy

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on January 22, 2007 8:36 AM.

The previous post in this blog was Firefox Extensions.

The next post in this blog is JDeveloper 10.1.3.2 (WebCenter) Production.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle