Thursday, April 11, 2013

How To Control ADF Table Pagination on Runtime and Do Case Insensitive Search

I decided to update my sample app from previous post - ADF 11g PS6 - ADF 10g Table Pagination Feature is Back Finally with option to change page size dynamically on runtime. Change between scroll and page mode is implemented, plus case insensitive table column filter option is enabled. Updated sample - TablePaginationApp_v3.zip comes with choice list to select page size:


There is button to force page size change, it calls af:setPropertyListener:


Listener is copying selected page size from choice list and sets Range Size in table iterator. Table Fetch Size by default is set to be equal iterator Range Size - this is how we can change dynamically table page size:


FetchSize is equal table iterator Range Size:


Switch between scroll and page modes is implemented in backing bean - changing scroll policy and doing surrounding panel collection PPR:


By default, when table is loaded - 10 rows are displayed:


You can change to 25 rows:


Switch between scroll and page modes from panel collection menu:


Rendering scroll mode now - no option to change page size, all rows are displayed:


This is how we can control table layout.

Let's see how column case insensitive search works - this is just one property change for the af:column tag. Try to search for First Name - "steven":


There will be no results - by default case sensitive search is executed in ADF table:


How to enable case insensitive search for af:column - easy. Select af:column you want to apply case insensitive search:


Set "caseInsensitive" for FilterFeatures property of af:column:


Search again for "steven" - this time result is available:


15 comments:

Dang Viet Ha said...

This is the new version 11.1.1.7.0 of JDeveloper and ADF, right? Could you explain me what the PSx mean?

Thank you

Andrejus Baranovskis said...

PS6 is just a short name for 11.1.1.7.

Andrejus

Nikhil Kamthe said...
This comment has been removed by the author.
Andrejus Baranovskis said...

Hi,

I tested now, it works as expected. After sorting - pagination doesnt disappear.

Andrejus

Nikhil Kamthe said...

Also when i try to change the rangeSize of my tableVO from backing bean by setRangeSize(int), it doesnt get replected in the page

Andrejus Baranovskis said...

You should double check my sample app, it all works there.

Andrejus

Nikhil Kamthe said...

Hi,

Thanks for your reply.
If I add a setPropertyListener inside the button it works fine.
But when i try to change it in my backing bean, it doesn't get reflected on the screen.

Anonymous said...

Nikhil, Just retrieve the iterator used for the table and call setRangeSize on the iterator as well setRangeSize on VO..this way it works.

Regards

Mikhail

Sanjeeb Mahakul said...

Hi Andrejus,

I have a requirement to move to next page programmatically. I have a rangeSize 10 defined which will fetch 10 records/page, but based on some business logic i need to move to next page(or nth page).
Details of the thread is available at : https://forums.oracle.com/thread/2572122

Can you please suggest something .

Andrejus Baranovskis said...

You can use out of the box table pagination available from PS6.

Andrejus

Anonymous said...

Hi Andrejus,
I am using new version 11.1.1.7.0 of JDeveloper and use the property scrollpolicy = 'page' and deployed the application on weblogic server 10.3.5.0 den Table pagination is working fine.
But when we are using weblogic server 10.3.6.0 It is giving error:-


Error 500--Internal Server Error
weblogic.servlet.jsp.CompilationException: Failed to compile JSP /search.jspx
search.jspx:352:29: This attribute is not recognized.
scrollPolicy="page" autoHeightRows="0">

Andrejus Baranovskis said...

May be there is no correct ADF runtime on this newer server?

Regards,
Andrejus

Anonymous said...

Hi
I am achieving the pagination functionality.
Pagination nav bar is displaying below the table.
I need to display the pagination nav bar above the table.

Could you please suggest how to achieve the same?

Thomas Lassauniere said...

Hello Andrejus

I need help to implement your example.
I don't understand how to force table to execute query after clicking on the "Change" button.
I execute your example and it works fine but when I'm trying to redo the same thing, I have to refresh my all web page to see Range Size modification.

If you could help me, thanks

Thomas Lassauniere said...

Andrejus, I found a solution for my refresh problem.

I'm using new Jdevelopper 12C and by default, it adds into web.xml deployment profile a context-param name "oracle.adf.view.rich.SYNCROWS" enabled by default.

I removed thes line from web.xml file and now it's working as expected.


oracle.adf.view.rich.SYNCROWS
enable


Hope that this will help.