Wednesday, January 23, 2019

Right Align a Column in a Table in OAF Page

Right Align a Column in a Table in OAF Page
Use following code in (processRequest):

 OATableBean tbl = (OATableBean)webBean.findChildRecursive("xxVO1");
         tbl.prepareForRendering(pageContext);
         DataObjectList dataformat = tbl.getColumnFormats();
         DictionaryData data = (DictionaryData)dataformat.getItem(pageContext.findChildIndex(tbl, "TableColumn"));
         data.put(UIConstants.CELL_NO_WRAP_FORMAT_KEY, Boolean.TRUE);

Thursday, January 10, 2019

Making the Table rows Read Only in OAF Page

Making the Table rows Read Only in OAF Page
I have seen a lot of discussion on Oracle forums, where the user want to populate the data in read only mode but only specific rows.

Step -1: Create a transient attribute in the View Object attached to the Table of type Boolean.

Step -2: Create a SPEL.

Step -3: Attach this SPEL to the Read Only Property for the entire columns.

Step -4: Set the property at runtime for this Transient Attribute as TRUE or FALSE.


Write the below code in AM. This method is used to set the Read-only property to TRUE for each rows in the table.


------------- AM Code -----------------

    public void SetReadOnlyTrue() {

    OAViewObject var_vo = (OAViewObject)getXxVO1();

    if (var_vo!= null) {

    var_vo.executeQuery();

    int rowCountValue = var_vo.getRowCount();

    Row[] allRows = var_vo.getFilteredRows("XxAttribute","True");  /* Attribute in VO which specifies that the row is read only. */

    for ( int x= 0; x < allRows.length; x++ ){

    XxVORowImpl rowi = (XxVORowImpl)allRows[x];

    if(rowi!=null){

    rowi.setAttribute("TransientAttribute", Boolean.TRUE); }

    }

    }

    }

Call this method in controller (processRequest or processFormRequest).