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
Brad Nordling 9Brad Nordling 9 

How can I change the color of a pageblocktable row conditionally?

I am looking at this post online, like others I've seen, that shows how to do this with styleclass:

styleClass = "{! If(lstGrnRate.Status__c=='RED' ,'redColour', If(lstGrnRate.Status__c=='GREEN','greenColour', 'greyColour')) }" />

My question is the comparison includes a value from the current record on the left but on the right, it is hard coded (=='RED').  How can I specify a value from the controller on the right side? 

I'd like to do it something like this but it doesn't work:
styleClass = "{! If(lstGrnRate.Status__c=='{!Property}' ,'redColour', If(lstGrnRate.Status__c=='GREEN','greenColour', 'greyColour')) }" />
PriyaPriya (Salesforce Developers) 
Hi Brad,

Kindly refer this scenario which matches your requirement :-

https://salesforce.stackexchange.com/questions/93895/conditionally-color-a-row-in-a-pageblocktable
 

Kindly mark it as the best answer if it works for you.

 

Thanks & Regards,

Priya Ranjan