You need to sign in to do that
Don't have an account?
Change the background color of row in apex:pageBlockTable
Can anyone help me for the syntax of changing the background color of row in the tag of apex:pageBlockTable?
<apex:pageBlockTable value="{!forecastUser.manager2OWrappersFiltered}" var="o" id="oppTable">
<apex:column headerValue="Sales Rep">
<apex:outputField value="{!o.manager2Owners.Sales_Rep__c}" />
</apex:column>
<apex:column headerValue="Account Name">
<apex:outputField value="{!o.manager2Owners.Opportunity__r.AccountId}" />
</apex:column>
<apex:column headerValue="Opportunity Name">
<apex:outputLink value="/{!o.manager2Owners.Opportunity__r.Id}">{!o.manager2Owners.Opportunity__r.Name}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
The best way is to format your table through repeat control. You can put <tr> and <td> inside the <apax:repeat> component and can assign the background color by using style attribute of table. Go through the sample code given below :
<apex:repeat value="{!Account}" var="a" >
<div style="width:61%;display:block;" ondblclick="HideShow(this.id,'{!a.id}','n');">
<table border="2">
<tr>
<td width='25%'><a href="#" onclick="popu('{!a.id}');fetchdata('{!a.id}');fetchdata1('{!a.id}');" ondbclick="change();"><h2>{!a.name}</h2></a></td>
<td width='25%'><h2> <span style="width:45%">{!a.phone}</span></h2></td>
<td width='25%'><h2> <span style="width:25%" >{!a.billingcity}</span></h2></td>
<td width='25%'> <span style="width:25%" class='rows'>{!a.CreatedDate}</span></td>
</tr>
</table>
</apex:repeat>
Hope this helps.
I would think you can accomplish what you want with the rowClasses attribute of pageblocktable.