Saturday, November 10, 2012

OAF:Set Text Color/Highlight record

Lets discuss on some of the common requirements in custom OAF pages

When ever there is a business validation failure display the content(text) in red color/other or mark the text.
This can be achieved by defining a custom css style.

CSSStyle cellBGColor = new CSSStyle();
cellBGColor.setProperty("color","#FF0000");
#FF0000--red color
OAMessageStyledTextBean field12=(OAMessageStyledTextBean)webBean.findChildRecursive("field12");

if(field12 != null )
field12.setInlineStyle(cellBGColor);

-----------------------------------------------------------------

One more requirement was to set color for the records dynamically.
Once user select and submit a record in a advanced table
the region is refreshed and the selected row should be unchecked and record should be highlighted.

That mean when the page refreshes only certain record should be highlighted.



TO achieve this we create a transient attribute in the VO
based on our condition we set the value for it.



--Code in AM
--rowlineVo --row handler
--we try to use existing styles instead of defining new one
rowlineVo.setAttribute("color","OraBGGrayMedium");


--Process request CO
OAMessageStyledTextBean field1 = (OAMessageStyledTextBean)webBean.findChildRecursive("Field1");
OADataBoundValueViewObject css2 = new OADataBoundValueViewObject(field1, "color");
field1.setAttributeValue(UIConstants.STYLE_CLASS_ATTR,css2);

This worked with out any issues..

If you want different colors based on the data we need to use OADataBoundValueViewObject.
OADataBoundValueViewObject css2 = new OADataBoundValueViewObject(field1, "color");

The first parameter the field which we want to apply the color and the second parameter is the vo attribute which need to be used.





6 comments:

Sherlyn Torbett said...

Thank you friend for sharing this oracle query

Sridevi Koduru said...
This comment has been removed by the author.
Joseph A. Wallace said...

Thanks for Information Oracle Apps Technical is a collection of a bunch of collected applications like accounts payables, purchasing, inventory, accounts receivables, human resources, order management, general ledger and fixed assets, etc which have its own functionality for serving the business.Oracle Apps Technical Online Training

Cub Training said...

Its impressive to know something about your note on Oracle apps Course. Please do share your articles like this your articles for our awareness. Mostly we do also provide Online Training on Cub training oracle apps course.

Sridevi Koduru said...
This comment has been removed by the author.
Sridevi Koduru said...

Regards
Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, SQL, PL/SQL, D2K at sridevikoduru@oracleappstechnical.com | +91 - 9581017828.