Saturday, 11 May 2013

Color The Item Based On Employee Position in Advanced table


Step 1:
Create EO Based VO i.e,EMPVO
SELECT EMPEo.EMPNO,
       EMPEo.ENAME,
       EMPEo.JOB,
       EMPEo.MGR,
       EMPEo.HIREDATE,
       EMPEo.SAL,
       EMPEo.COMM,
       EMPEo.DEPTNO,
       EMPEo.CREATION_DATE,
       EMPEo.CREATED_BY,
       EMPEo.LAST_UPDATE_DATE,
       EMPEo.LAST_UPDATE_LOGIN,
       EMPEo.LAST_UPDATED_BY,
       EMPEo.ROWID,DECODE (EMPEo.JOB
,'MANAGER', '1','2'
) color
FROM EMP EMPEo

Step 2:Under Custom.xss

add Follwing code
<style name="For_Bold">
<property name="font-weight">bold</property>
<property name="font-size">10pt</property>
</style>

<style selector=".1">
<includeStyle name="DefaultFamily"/>
<property name="font-size">11pt</property>
<property name="font-weight">Bolder</property>
<property name="color">#FFFF00</property>
<property name="text-indent">3px</property>
<property name="background-color">#FF0000</property>
</style>

<style selector=".2">
<includeStyle name="DefaultFontFamily"/>
<property name="font-size">11pt</property>
<property name="font-weight">Bolder</property>
<property name="color">#FFFF00</property>
<property name="text-indent">3px</property>
<property name="background-color">#003399</property>
</style>


the path of the custom.xss is in $OA_HTML/cabo/Styles/custom.xss


Under Process Request:
    OAApplicationModule am=( OAApplicationModule)       pageContext.getApplicationModule(webBean);
    EMPVOImpl vo=am.getEMPVO1();
    vo.executeQuery();
    OAAdvancedTableBean table = (OAAdvancedTableBean)webBean.
    findIndexedChildRecursive("region2");
    OAColumnBean ejobcol = (OAColumnBean)webBean.
    findIndexedChildRecursive("column1");
    OAMessageTextInputBean job = (OAMessageTextInputBean)ejobcol.
    findIndexedChildRecursive("item1");--for which item you wanted color
    OADataBoundValueViewObject cssjob = new OADataBoundValueViewObject(job,"Color");
    job.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, cssjob);


O/P will be like:




No comments:

Post a Comment