Friday, March 28, 2014

ADF 11g PS6 Table Pagination and Displaying Selected Row Issue - Solution

While ago, I had a blog post about new feature in ADF 11g PS6 (11.1.1.7) - table pagination support. There is an issue, when we want to open specific row and display it automatically in the table - required table page for the selected row is not opened correctly. However, blog reader suggested a fix, received from Oracle Support. Blog reader was kind enough, to post a comment with suggested fix, you can read it here - JDev/ADF sample - ADF 11g PS6 Table Pagination and Displaying Selected Row Issue. I decided to test this fix myself and provide updated sample application. The fix is to use range start from the iterator and set to it for the first property of the table with pagination. Actually, this fix does the job, but not completely perfect. Current row is displayed, only if Range Size for the iterator is set to 25, probably there is some hard coding somewhere. Ok, but at least it works.

Download sample application - TablePaginationApp_v5.zip. This application contains two fragments, second fragment with the table is opened from the first - where current row is selected. In the first fragment, we call setPropertyListener for navigation button and save required information in pageFlowScope (to be used in the second fragment):


This information - range start, once we move current row in the row set, range start is also changed. We are going to use range start, to set first property for the table - in such way, we could force table to display required page with selected row:


Here you can see, how table first property is set - we are using range start saved in pageFlowScope in the first fragment. This would force ADF table with pagination to display required page of rows:


Let's see how this works. Select a row belonging to the first range (I have configured Range Size to be 25):


Table with pagination is loaded and selected row is displayed in the first page, this is correct:


Navigate to some row from the second range (this should be after first 25 rows):


Selected row is displayed in the second page, as expected. There is one small issue - selected row is displayed at the bottom, while it should be somewhere in the middle. Well, this is another issue related to ADF table pagination:


If you navigate back to the first page and then again navigate to the second page - selected row will be displayed correctly in the middle:


In my opinion, ADF table pagination is not yet very tested and stable feature. Perhaps we should wait for improvements in the next release, until using it in the complex scenarios.

5 comments:

Anonymous said...

The link to sample application is not working. Can you please upload the sample application

Andrej Baranovskij said...

It works to download for me, probably some problem with your internet. Double check on your side.

Regards,
Andrejus

Anonymous said...

Thanks Andrejus,

It works. I ran the sample application. The page navigation is not working. When I change the table page number it does not refresh the table data. Also, it always shows the first row as selected. for example, when i select employee 115 from first page and go to second page it shows first row as employee 115 selected. range 115- 139 for page size 25.

Regards

Andrej Baranovskij said...

It works as described in the screenshots. You should double check, may be you changed something. Are you using ADF 11g PS6 (11.1.1.7)?

Andrejus

Anonymous said...

Thanks Andrejus. I recreated workspace and works now.