Display newly added row as first record in Result set (OAF ADVANCE Table)

This is the most requirement for OAF developers to display newly added record as first in result set. Sharing the code snippet, retrofit as per the requirement


Below code will be add number rows based on the parameter provided "noOfRowsAdd" in below method 

public void addRows(OAPageContext pageContext, OAWebBean webBean , String noOfRowsAdd)
    {
        OAApplicationModule am = pageContext.getApplicationModule(webBean);
      XXVOImpl TabResultVO =(XXVOImpl )am.findViewObject("XXVO1");
      TabResultVO.setMaxFetchSize(0);
      for (int i = 0; i < Integer.parseInt(noOfRowsAdd); i++)
      {
        Row row1 = TabResultVO.createRow();
        TabResultVO.setCurrentRow(TabResultVO.first());
        TabResultVO.insertRow(row1);
        row1.setNewRowState(Row.STATUS_INITIALIZED); 
        row1.setNewRowState((byte)-1);
         row1.setNewRowState((byte)-1);
      }
    }


Use this method in ProcessForm Request method 

    public void processFormRequest(OAPageContext pageContext,   OAWebBean webBean)
    {
        super.processFormRequest(pageContext, webBean);
        OAApplicationModule am = pageContext.getApplicationModule(webBean);
        
        // Submit Button Code 
        if (pageContext.getParameter("BtnEvt")!= null)
       {
      addRows(pageContext,webBean,"3");
      }
     }


Below is the screenshot , show 3 records added , since we have passed 3 as input parameter  to insert the records



Comments

  1. Our knowledge is truly enhanced after reading th8is. It was quite useful. We are truly glad that you shared this with us. Here is a referred link same as yours oracle fusion financials training. While browsing, I came across this one, it's useful and will be providing necessary knowledge too.

    ReplyDelete

Post a Comment

Popular posts from this blog

Sample HZ API's script to Create Contacts and Contact Points in Oracle

REST integration built-in OIC to read Large files with size more than 10MB