Partial Page Rendering (PPR) in OAF
PARTIAL PAGE RENDERING (PPR) IN OAF
PPR is a technology that lets you refresh a specific part of a page when you want to make a UI change instead of having to refresh (redraw) the entire page.
Gives users a more responsive and interactive application
Improves application Performance
Steps for Partial Page Rendering:-
First create one workspace and project.
Create the AM.
Create one Page and attach the page AM to it.
Create one Entity object and VO and attach to AM.
Create the controller.
For PartialRendering here I am using my data insert project only.
The structure of my data insert project is like this.
The output of my Data Insert page is like.
For partial Rendering in the above example
If the position code is “DIRECTOR” it should hide the managerID
For this first make the position code item as message choice.
position-->itemStyle-->messegeChoice
DATA-->
piclistViewInstance-->Give the view instance name
PicklistDisplayAttribute-->what we want to display in message choice
the column name of that(Meaning)
PiclistValueAttribute-->what value shuld take.
Next create one PartialVO without any query.
And after that create one transient attriobute.
Right click on PartialVO and select edit.
Click new.
U will get the window for creating new attribute set the following properties.
Name:- ManagerIDRendered
Type:- BOOLEAN.
Click Apply and ok.
After creating the partialVO.
Select the positionCode item and in the property inspector set the following properties.
Client Action---- >
Action Type-- > firePartialAction.
Event --- > positionEvent.
Select the managerID item and set the following properties
managerid-->visual
->Rendered-->${oa.<Partial View Instance Name>.<New Attribute Name>}
${oa.PartialVO1. ManagerIdRendered}
Create one method in AM java file
public void Partialvo()
{
OAViewObject vo=getPartialVO1(); //we have to create one new partialvo
if(!vo.isPreparedForExecution())
{
vo.executeQuery();
}
OARow row=(OARow)vo.createRow();
vo.insertRow(row);
vo.first().setAttribute("ManagerIdRendered",Boolean.TRUE);
}
Create the method for hide and show of managerID
public void showManager(String PositionCode)
{
OAViewObject vo=getPartialVO1();
if(PositionCode.equalsIgnoreCase("DIRECTOR"))
{
vo.first().setAttribute("ManagerIdRendered",Boolean.FALSE);
}
else
{
vo.first().setAttribute("ManagerIdRendered",Boolean.TRUE);
}
}
Write the following code in processRequest of the controller.
OAApplicationModule am=(OAApplicationModule)pageContext.getRootApplicationModule();
//call the method we created for creating new row
am.invokeMethod("Partialvo");
Write the following code in the processFormRequest.
if(eventName.equalsIgnoreCase("positionEvent")) //the event name that we given in
position column
{
String position=pageContext.getParameter("PositionCode"); //the id of the position column
Serializable [] parm={position};
am.invokeMethod("showManager",parm);//we have to call the method that we created for showing managerid
}
}
Run the page to see the output.
If u select the position as director the manegerID should hide.
No comments:
Post a Comment