You need to sign in to do that
Don't have an account?
MnZ321
Changing Table value dynamically through css
I have a picklist called Status, displayed in a Visualforce table with fields like ..
Closed
Open
Critical
How can make all fields GREEN except the ones that are Critical RED? I have tried this code so far...
<style>
.errorClass {
background-color: red;
}
.normalClass {
background-color: green;
}
</style>
=================================
<apex:pageBlock>
<apex:pageBlockTable value="{!fb}" var="item">
<apex:column value="{!item.name}"
styleClass="{!IF(item.status__c == 'Critical','errorClass','normalClass')}"/>
<apex:column value="{!item.status__c}"
styleClass="{!IF(item.status__c == 'Critical','errorClass','normalClass')}"/>
</apex:pageBlockTable>
</apex:pageBlock>
=================================
public class dataTableCon {
List<Feedback__c> fb;
public List<Feedback__c> getAccounts() {
if(fb== null) fb= [select Name, Description__c, Importance__c, Resolution__c, Status__c,Owner.name from Feedback__c];
return fb;
}
}
=================================
ERROR..
Error: Formula expression is required for attribute value in <apex:pageBlockTable> in vf_table at line 49 column 56
Closed
Open
Critical
How can make all fields GREEN except the ones that are Critical RED? I have tried this code so far...
<style>
.errorClass {
background-color: red;
}
.normalClass {
background-color: green;
}
</style>
=================================
<apex:pageBlock>
<apex:pageBlockTable value="{!fb}" var="item">
<apex:column value="{!item.name}"
styleClass="{!IF(item.status__c == 'Critical','errorClass','normalClass')}"/>
<apex:column value="{!item.status__c}"
styleClass="{!IF(item.status__c == 'Critical','errorClass','normalClass')}"/>
</apex:pageBlockTable>
</apex:pageBlock>
=================================
public class dataTableCon {
List<Feedback__c> fb;
public List<Feedback__c> getAccounts() {
if(fb== null) fb= [select Name, Description__c, Importance__c, Resolution__c, Status__c,Owner.name from Feedback__c];
return fb;
}
}
=================================
ERROR..
Error: Formula expression is required for attribute value in <apex:pageBlockTable> in vf_table at line 49 column 56
You can do like below. May be it will helpful to you.
<apex:page controller="dataTableCon">
<style>
.errorClass {
background-color: red;
}
.normalClass {
background-color: green;
}
</style>
<apex:pageBlock >
<apex:pageBlockTable value="{!fb}" var="item">
<apex:column value="{!item.name}" styleClass="{!IF(item.status__c == 'Critical','errorClass','normalClass')}"/>
<apex:column value="{!item.status__c}" styleClass="{!IF(item.status__c == 'Critical','errorClass','normalClass')}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
public class dataTableCon{
public List<Feedback__c> fb{get;set;}
public testPicklistValueColour ()
{
fb = new list<Feedback__c>();
fb= [select Name, Description__c, Importance__c, Resolution__c, Status__c,Owner.name from Feedback__c];
}
}
Thanks,