Monday, July 16, 2012

Issue with Show Printable Page Behavior in ADF 11g R2 (11.1.2.2.0)

You may experience strange issue in ADF 11g R2 (11.1.2.2.0, 11.1.2.1.0), related to printable page behavior. After af:showPrintablePageBehavior operation is applied, ADF fails to register Active Data for command component on runtime. It doesn't seem to break application completely, but obviously is annoying for the users. Same issue related to Active Data registration is reproduced after applying export to Excel operation. This seems to be a bug and most likely will be fixed in the next ADF versions. There are workarounds how to overcome Active Data registration bug, I will describe them at the end of this post.

Download sample application, where printable page behavior error is reproduced - PrintPageBehaviorApp.zip. This application is very basic - contains only one page, no ADF regions.

There is Print link, it invokes af:showPrintablePageBehavior operation:




Run sample application, open tab with Employees table data:


Print employees data, press Print link - printable page will be loaded from another browser tab:


Go back to application and select another tab - Department data:


Active Data registration error happens, on the next invoked action after show printable page behavior was invoked.

There are several workarounds. One of them you should try first - set ChangeEventPolicy to none (by default - ppr) for related iterator from page definition:


This works, but not always. I noticed that for more complex pages with ADF regions, it doesn't help to set ChangeEventPolicy to none.

Another option is to implement printable page rendering programmatically (it will render in the same browser tab where application is launched). Read more about this solution here - ADF Code Corner 95. How-to Navigate to Printable Pages.

7 comments:

Martin said...

Hi Andrejus,

"you put your finger in the wound" ;).

We had this exception too, a problem is that our pages are sometimes very complex so we decide to set the changeEventPolicy for every application to "none" global in adf-config.xml.

" "

Thank you for your valuable tips!

Martin

Andrejus Baranovskis said...

Hi Martin,

Yes - this is quite painful bug, hope it will be fixed in next release.

In my project, we use a lot of dynamic regions - I experienced it doesn't help even to set changeEventPolicy to "none". I'm glad it works in your case ! :)

Andrejus

Frank Nimphius said...

I filed a bug and provided Andrejus sample as a test case. As said, hope alone doesn't fix problems ;-)

Andrejus Baranovskis said...

Thanks a lot Frank :-) i dont think customer had time to fill bug yet. This is important not to be alone:-)

Luvsansharav.A said...

Thanks Andrejus! It was very helpful

Govindaraj M said...

Hi Andrejus,

This shows how to print a data from the tables. is there way to print the data from the form?

Thanks,
Govind

Andrejus Baranovskis said...

Same method should work.

Andrejus