+ Start a Discussion

Conditionally Render PageBlock Table Rows?

Somewhat new to VF but not SF. 


Have a pageBlockTable and I'm trying to conditionally render a row based on record type.  So if recordtype = X, then render the row.

Is this the right approach or is something better?  Not having luck figuring out way to do this aside from put a render statement for each column, which can't be correct.



<apex:pageBlock rendered="{!$ObjectType.EntityAddress__c.accessible}" title="Location Addresses">


<!-- Been trying to add the render statement to line below? So if record type is X then render that row else do not -->

<apex:pageBlockTable value="{!contact.provideraddresses__r}" var="provideraddress">


<apex:column headerValue="Is Active" value="{!provideraddress.Active__c}"/>


<apex:column headerValue="Type" value="{!provideraddress.Address_Type__c}"/>


<apex:column headerValue="Street" value="{!provideraddress.Address__r.Address_Line_1__c} {!provideraddress.Address__r.AddrLn2__c}"/>      


<apex:column headervalue="City" value="{!provideraddress.Address__r.City__c}"/>


<apex:column headervalue="State" value="{!provideraddress.Address__r.State__c}"/>





Best Answer chosen by Admin (Salesforce Developers) 

I don't think column will work, but repeat might.


<apex:page controller="repeatCon" id="thePage">

    <apex:repeat value="{!strings}" var="string" id="theRepeat">

        <apex:outputText value="{!string}" id="theValue" rendered="{!string!='TWO'}"/><br/>




public class repeatCon {
    public String[] getStrings() {
        return new String[]{'ONE','TWO','THREE'};



This example will print out the list except for the "TWO" - You could probably adapt this format to what you are trying to do.  It may not work exactly with tables, but divs or ul/li would definitely work.