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:


32 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

Andrej Baranovskij said...

PS6 is just a short name for 11.1.1.7.

Andrejus

Nikhil Kamthe said...
This comment has been removed by the author.
Andrej Baranovskij 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

Andrej Baranovskij 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 .

Andrej Baranovskij 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">

Andrej Baranovskij 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?

Unknown 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

Unknown 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.

Anonymous said...

i have this problem: my rangeSize=50 and the query return a greater number of rows(1700), my boss does not want a rangeSize that big becouse the app is getting slower, the problem reside when i want to select one row, gives me the null pointer exception only when the size of the query is bigger than the rangeSize, if the query returns 50 or less rows everithing works fine, what should i do if i can´t move the rangeSize from there?

Andrej Baranovskij said...

I'm not sure, this would require testing your app. Ask your boss to hire us to help :-)))

Andrejus

Anonymous said...

Hi,
I have a requirement of ADF table pagination and select table row by using check box.
But when i go to next page using pagination and then come back to the first page the selected checkbox value getting reset.
I have checked the update property of the attribute is also marked as always and in the VO tuning 'persist transient attributes' is also marked.
Still the checkbox values getting reset.

Anonymous said...

Thanks Thomas Lassauniere...It helped!!!

Anonymous said...

Hi, Andrejus!
Please tell me why your example works on ADF 12.1.3.0.0 and does not work on 12.2.1.0.0 and 12.2.1.1.0?

Andrej Baranovskij said...

You should ask this question Oracle Support. I can't guarantee any solutions would work across releases :)

Regards,
Andrejus

Anonymous said...

Oh, thank to Thomas Lassauniere!
Setting oracle.adf.view.rich.SYNCROWS = disable, and everything works!

Andrej Baranovskij said...

Great :)

Unknown said...

Hi Andrejus

thanks for the great tutorial

In case I select the second page and change the range size then I expect the paging goes to the first page
I retrieve the iterator in a bean and setRangeSize as well as setRangeStart(0) but Its failed to reset to the first page

thank you

Andrej Baranovskij said...

I would not recommend using oracle.adf.view.rich.SYNCROWS = disable, this could lead to out of synch between ADF View fetch size and ADF model range size. You could start seeing scenarios when data is saved for different row, not the one selected on UI.

Regards,
Andrejus

VenkY said...

Hi Andrejus,

I am facing one issue related to table pagination.
I have a checkbox in the table which is derivied from POJO data control.
I have applied scroll policy as "page" for pagination purpose .
The checkbox value is not retained while traversing to and fro.
Please let me know how to handle this

Asuman AKYILDIZ said...

Hi;

Could you please provide an active link?

Andrej Baranovskij said...

You can download old samples from here - https://code.google.com/archive/p/jdevsamples/downloads

Andrejus

Anonymous said...

Hi,

I am facing a issue in pagination like when i select a row on 2nd or 3rd page and do some operations and again click on search brings me to 2nd page while it should give me 1st page instead
can you help with this.

Anonymous said...

the src source is not found in server..could you provide the new website to download it.tks

Unknown said...

Hi,
Am using Jdev 12c. My current application has ADF table with pagination. The requirement is to show the pagination bar on top as well as bottom of the page.
Any idea how can this be acheived in 12c?
I tried for setting table_control-bar-position after reading few blogs, but this doesn't seem to be a valid attribute anymore.
Also, with skinning, I can only have the navbar at one place, but my requ is to have at both places. Is this possible without custom bean code?

R said...

Hi Andrejus,

I am trying to write a code which iterates all rows of range-paging VO, but even after changing the page by calling scrollToRangePage(), the getAllRowsInRange() is always returning same set of rows.

What I could be missing?

public void excludeAllAL(ActionEvent actionEvent) {
//
//Code to get iterator binding
//
ViewObject detailVO = itrBinding.getViewObject();

int totalPages = detailVO.getEstimatedRangePageCount();
System.out.println("Number of pages: " + totalPages);

for (int p = 1; p <= totalPages; p++){
System.out.println("Moving to page: " + (p));

detailVO.scrollToRangePage(p); //This API changes the page
Row[] rows = detailVO.getAllRowsInRange(); //This API is supposed to get all rows for new page, but it is bringing same set of rows always

for (Row row : rows){
//DO SOMETHING
}
}
}