function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BrokenBirdBrokenBird 

pageBlockTable column styleClass not changing text color

For some columns of my pageBlockTable I am specifying a different StyleClass:

.SpendingStyle {background-color: lightgrey; color:grey; background-image:none}

 

<apex:column styleClass="SpendingStyle">
<apex:facet name="header"><b>Immediate Costs</b></apex:facet>
<apex:outputField value="{!aProject.project.Immediate_Costs__c}" />
</apex:column>
 

 

 

However the color of the text is never applied. What do I need to do to make the color of the text change?

 

Best Answer chosen by Admin (Salesforce Developers) 
TehNrdTehNrd

I forgot about this workaround, whoops. Wrap your outputfield in a span:

 

<span Class="fontColor"> <apex:outputfield value="{!o.Name}"/> </span>

 

 

 

All Answers

TehNrdTehNrd
For font color I think you would want to appy the style directly to the outputField tag rather than the column.
BrokenBirdBrokenBird
Still not working.
TehNrdTehNrd
Keep the style on the outputField but change it to outputText. I recal there being issues with syles and the outputField tags.
BrokenBirdBrokenBird
I can't really do that, using output text would mean I have to format all my values manually, and this can be quite a pain.
TehNrdTehNrd

I forgot about this workaround, whoops. Wrap your outputfield in a span:

 

<span Class="fontColor"> <apex:outputfield value="{!o.Name}"/> </span>

 

 

 

This was selected as the best answer
BrokenBirdBrokenBird
Thanks!!!
craigmhcraigmh

FYI, I've found that SFDC's styles are pretty stubborn. Something like this should work:

 

 

.SpendingStyle {background-color: lightgrey !important; color:grey !important; background-image:none !important}
 <apex:column  styleClass="SpendingStyle"><apex:facet name="header"><b>Immediate Costs</b></apex:facet><apex:outputField value="{!aProject.project.Immediate_Costs__c}" /></apex:column>

 

Although that's not exactly the prettiest hack.