OracleArea51

Sponsored By Chola Global Services LLC

Partial Page Rendering

E-mail
(7 votes, average 4.86 out of 5)
What is Partial Page Rendering?
PPR is a technology  that is used for refreshing only a part of a page when you want a UI change instead of having to refresh the whole page. A source event can trigger events to cause changes in target items.

Don't have an Vision instance to practice these tutorials? Visit http://cholagls.com/products-/11i-virtual-machine for details.Our smart solution to smart people like you !!

PPR is used for :
 
  • Hiding/Showing Objects
  • Required/Optional
  • Disabled/Enabled
  • Read only/Updatable
 

There are few items that enable PPR. They are:
 
  • resetButton
  • singleSelection
  • messageCheckBox
  • button
  • submitButton
  • and more..
 

You can also declaratively define your own PPR events for selected components. For example, you can:
•    Configure the selection of a poplist to cause related fields to render, be updateable, be required or be disabled based on the selected value.
•    Configure the value change of a text field to set related field values (if you set a Supplier value and tab out, the dependent Supplier Site defaults automatically).
•    Configure the selection of a master table's singleSelection radio button to automatically query and display related rows in a detail table.

Let us see an example where we can implement PPR.
Example: Depending on a value that is chosen in the poplist you need to render a item in the page. So this is what we are going to implement now. Here we have  a Quantity poplist. So if the quantity is selected only then the cost (textinput) should display.

BC4J


1.Whenever you implement PPR we create a PVO(Property View Object).Right click on Project select new - > Business Tier -> ADF Business Components - > View object.


Name - DisplayCostPVO
Package - < Depending on your project>


2.Go to the attributes page and click New.We are going to create 2 new transient attributes.

First Attribute:
Attribute Name - RowKey
DataType - String
KeyAttribute - Yes
Updatable - Always

Second Attribute:
Attribute Name - DisplayCost
DataType - Boolean
Updatable - Always

Click Next and then finish.We do not require any java files to be generated here.Do not forget to add the PVO to the AM.

Page



1.Create a new poplist (Refer Here )and then a item with style as messageTextInput or messageStyledText.
2.The following properties needs to set in the poplist.In general you will be setting values for View Definition,View Attribute,View Instance. But for PPR you need to set 2 main properties:


ID - Quantity
Action Type - firePartialAction
Event - quantity


3.Create a new item as Cost with messageInputText as the Item style.

Set the following properties:


Id - Cost
Prompt - Cost
View Name - < As per your VO>
View Attribute - < As per your VO>
Rendered - ${oa.DisplayCostPVO1.DisplayCost}  ( DisplayCost in the attribute we set in the PVO)
CSS Class - OraDataText



Code




Add the following in processFormRequest:
 if ("quantity".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))  
 {            
 String value_selected = (String) pageContext.getParameter("Quantity");           
 
 if ((!(("".equals(value_selected)) || (value_selected == null))) )  
 {              
 Serializable[] params8 = {"TRUE"};
 am.invokeMethod("handleCostChangeEvent", params8); 
 }





 public void initDisplayCost()
 {
 OAViewObject appPropsVO = (OAViewObject) findViewObject("DisplayCostPVO1");
 if (appPropsVO != null) 
 {
 if (appPropsVO.getFetchedRowCount() == 0) 
 {
 appPropsVO.setMaxFetchSize(0);
 appPropsVO.executeQuery();
 appPropsVO.insertRow(appPropsVO.createRow());
 OARow row = (OARow) appPropsVO.first();
 }
 }     
 handleCostChangeEvent("FALSE");
 } 


 public void handleCostChangeEvent(String Quantity)
 {
 OAViewObject vo = (OAViewObject) findViewObject("DisplayCostPVO1");
 OARow row = (OARow) vo.first();
 if (Quantity.equals("TRUE")) 
 {
 row.setAttribute("DisplayCost", Boolean.TRUE);
 } 
 else 
 {
 row.setAttribute("DisplayCost", Boolean.FALSE);
 }
 } 



Aarthi Sudhakar
Points: 1501
Contact Author | Website :
 

Related Posts:

relatedArticles
Trackback(0)
Comments (6)add comment

Rafael Reuber said:

Rafael Reuber
...

Thank you very much. This tutorial was very useful for me.
 
August 05, 2009
Votes: +0

Akhil said:

0
...
Hi Aarthi, Thank you so much for the document. It was very useful for me. I did like u specified and it worked perfect for me.

I have a question though. Its working for changing the Rendered property of an object but its not working to make the object Required or Not Required. I also changed the field to String from Boolean and tried to return "true" or "false" but still not working. Can you please help..

Thanks
Akhil
 
August 19, 2009
Votes: +0

Sudhakar Mani said:

Sudhakar Mani
...
Hi Akhil,
You have to set the string value to 'Yes' or 'No' for the required property.

Regards
Sudhakar
 
August 19, 2009
Votes: +0

Ravi Sharma said:

Ravi Sharma
...
Hi , How do we populate another field on the basis of value entered in the Site LOV ?

For e.g Is the supplier site LOV is entered, the payment terms of that site needs to be populated in the associated VO attribute. Will it be done through PPR ?
 
December 03, 2009
Votes: +0

jithen12 said:

0
...
Hi,
Can Anyone tell me how to hide or show of image item which is having one URL in the table region with other colums
and how to hide or show conditionally of image based on the neibouring column values in table .it works for all other items but it is not working for image either with PPR or Code in the CO. as i need to it for standard page where we cannot go for switcher case can anyone tell how to handle image conditionall.
Thanks,
Jithen
 
January 19, 2010
Votes: +0

Sudhakar Mani said:

Sudhakar Mani
...
Jithen,
You have to use switcher to achieve your requirement.

Regards
Sudhakar
 
January 19, 2010
Votes: +0

Write comment

busy