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
SamirKhanSamirKhan 

Style class not working in Apex:column tag

I have created a VF page where in I am displaying some rows in a Table.
What i am trying to achieve is - there is one row named "Status" in the table.Status can have 3 values - RED , GREEN , GREY.
How can i color the row depending upon the value in the status field.
Below is my VF Page
 
<apex:page controller="AccountSummaryReportController" action="{!loadKeyAccounts}"  >


    
    <style>
             
             body .bPageBlock .pbBody .grey .pbSubheader{
                background-color:#c0c0c0;
            }
            body .bPageBlock .pbBody .grey .pbSubheader h3{
                color:#000;
           
                
      .greenColour {color:green;}
      .redColour {color:red;}
      .greyColour {color:grey;}  
            
        </style>
    <apex:sectionHeader title="Account Summary Report as of : {!TODAY()}"  description="This Report Shows Accounts modified in last 31 days"/>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!renderAsPdf}" value="Save as Pdf"/>
            </apex:pageBlockButtons>
            <apex:repeat value="{!objectMap }" var="ProgNameKey" >
                <apex:pageBlock title="{!ProgNameKey}" id="c">
                    <apex:repeat value="{!objectMap [ProgNameKey]}" var="PlanNameKey" >
                        <apex:outputPanel styleClass="grey" layout="block">
                            <apex:pageBlockSection title="{!PlanNameKey}" columns="1" >
                                <apex:pageBlockTable value="{!objectMap [ProgNameKey][PlanNameKey]}" var="lstGrnRate"  border="1" columnsWidth="20%,10%,70%">
                                    <apex:column value="{!lstGrnRate.Account__r.Name}"/>
									
                                    
                                    <apex:column value="{!lstGrnRate.Status__c }" 
                                      styleClass = "{! If(lstGrnRate.Status__c=='RED' ,'redColour',
                                                      If(lstGrnRate.Status__c=='Green','greenColour', 'greyColour')) }" /> 
													  
													  
          
          
                                    <apex:column value="{!lstGrnRate.Account_Summary__c}"/>
                                </apex:pageBlockTable>
                            </apex:pageBlocksection>
                        </apex:outputPanel>
                    </apex:repeat>
                </apex:pageBlock>
            </apex:repeat>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
Siddharth83JainSiddharth83Jain
Hi Samir,

If styling is not a issue, you can try replacing you inner pageblock with HTML component. Use a <tr> tag and then implement styling that would be correct and more effective.

Please mark this as best answer if it helps.

Thanks
Siddharth
OSI Consulting