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.


6 comments:

  1. Replies
    1. Do you want to refresh the whole page or you want to refresh partially.

      Delete
  2. Hi ,

    I have three picklists in my page. based on the first and second picklist selection third picklist need to show the values. I have achieved this using PPR.
    As of now it is working fine for me but problem is when i am running the page getting the correct output but missing the values in 3rd picklist.

    Please help to resolve this issue asap.

    Thanks,
    sateesh

    ReplyDelete
  3. Hi, I have done partial page rendering in my page. I have created 3 regions in the page. 1st region is the header in which i have created one messagechoice item (lets call it as x). Depending on the value in x. I display either the region 2 or region 3. Now the problem is when region 2 or region 3 is displayed, the LOVs present in these region dont work. I mean the pop up doesnt trigger. We can enter the value by typing the values slowly but the pop up is not triggering. Could you please let me know where i'm going wrong in this.

    Regards,
    Amit

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete