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
NjangaNjanga 

Condition expression on vf Pgae pageblocktable

I Want to render content with different css style;

This is my vf code.

<apex:pageblocktable value="{!queryResult}" var="cso">
     <apex:column value="{!cso.status}"  style="{!if(cso.status == 'complete','background:green;font-weight: bold', 'color:black')}"  headervalue="Status" />
</apex:pageblocktable>

 

This is Working.

Now what i need is to add another condition to check if cso.status == 'in progress' and set a pink background.

 

Best Answer chosen by Admin (Salesforce Developers) 
NjangaNjanga

I found a way:

This is my code:

                                    <apex:column value="{!cso.status}"  style="{!if(cso.status == 'in progress','background:pink;font-weight: italic', 'color:black')};{!if(cso.status == 'complete','background:green;color:white', 'font-weight: italic')}" headervalue="Status" />

 

All Answers

NjangaNjanga

I found a way:

This is my code:

                                    <apex:column value="{!cso.status}"  style="{!if(cso.status == 'in progress','background:pink;font-weight: italic', 'color:black')};{!if(cso.status == 'complete','background:green;color:white', 'font-weight: italic')}" headervalue="Status" />

 

This was selected as the best answer
BobBBobB

Very useful. Thanks for sharing. ....bob