Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Adding CSS style dynamically through styleclass

Adhakshi-OracleMay 11 2015 — edited May 11 2015

Hi,

We have a requirement to apply styles to specific cells in the ADF table dynamically.

For Example., If there are 3 columns in the table, the requirement is that cells having values less than 50 in the "column3" should be having the background color red.

We will know the information about the style like whether it is background color or foreground color and the color to be applied at runtime only.

We might be able to implement this using inlinestyle property.

But if there are more number of cells in the table having this property,inline style will be redundant and repeating more times.

So we thought of making this as a style class.

Approaches-

1. Adding a style class to the skin CSS file at runtime.We need to add the style class during rendering and remove it after that. But we need to do file operation each time here.

2. Referring an external style sheet, but the external style sheet also need to be created at runtime and dynamically referred in the JSPX or JSFF file. This also involves file operations. In addition to this, we are not sure whether the stylesheet name can be given from the backing bean at run time.

3. Create a skin CSS file at run time and that should import the base skin CSS file. If there are no styles to be applied at run time, base skin CSS file will be applied. If there are any styles to be applied, newly created skin CSS file will be applied. We have provisions to give the skin CSS file at run time through EL expression. This also involves file operations and it seems to be an inefficient approach.

Can any one please let me know if there is any other way we can implement our requirement in ADF?

Jdev version - 11.1.1.7

Thanks,

Alagappan

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2015
Added on May 11 2015
5 comments
443 views