Monday 3 October 2011

Dynamically Change the color of rows in advanced table region

Step1: Call this below code from ProcessRequest(............,.............) 
OAAdvancedTableBean table = (OAAdvancedTableBean)webBean.
findIndexedChildRecursive("ResultsTable");
OAColumnBean ejobcol = (OAColumnBean)webBean.
findIndexedChildRecursive("Column3");
OAMessageStyledTextBean job = (OAMessageStyledTextBean)ejobcol.
findIndexedChildRecursive("Job");
OADataBoundValueViewObject cssjob = new OADataBoundValueViewObject(job,"Color");
job.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, cssjob);
 
Step2: Edit custom.xss and paste the below Code:
Path:   C:\santhoshJdev\jdevhome\jdev\myhtml\OA_HTML\cabo\styles.
Write the following code at <!--Please start your customization at here ----!> 
 
<style selector=".1">
<includeStyle name="DefaultFontFamily"/>
<property name="background-color">#FF0000</property>
</style>
<style selector=".2">
<includeStyle name="DefaultFontFamily"/>
<property name="background-color">#FFCC00</property>
</style 
 
Step 3: save and run...now the output will be
 
 

2 comments:

  1. Hi Santhosh,

    Thanks for your post.

    I have a requirement to color the entire cell. In the example you have provided the colouring is done only to the text. Is it possible to color the background of the entire cell.

    I was expecting applying the style on the column bean might work, but it did not.

    OAAdvancedTableBean table = (OAAdvancedTableBean)webBean.
    findIndexedChildRecursive("ResultsTable");
    OAColumnBean ejobcol = (OAColumnBean)webBean.
    findIndexedChildRecursive("Column3");
    OADataBoundValueViewObject cssjob = new OADataBoundValueViewObject(ejobcol,"Color");
    ejobcol.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, cssjob);

    ReplyDelete
    Replies
    1. Hi Drila

      I think we can do it with CSS classes. but i didn't come across this issue, So please use the below link to find the css class names which are suitable for table/advanced table.

      http://mystuffoaf.blogspot.in/2011/10/css-class-names-in-oaf.html

      Delete