[SalesForce] Conditionally render an

All,

I am trying to create a visual display of a list of contacts that are considered "High" influence. There is a pick-list field within the contact object that can be set to this value. I am using apex:repeat to create the list and would like to use "rendered =" to filter out the unimportant contacts.

              <apex:repeat value="{!Account.Contacts}" var="con" rows="6">
                    <tr>
                        <td class = "entry"><apex:outputField value="{!con.Name}" rendered=" {!con.Influence__c = 'High'}" styleClass="entry"/></td>
                        <td class = "entry"><apex:outputField value="{!con.Title}" rendered=" {!con.Influence__c = 'High'}"/></td>
                        <td class = "entry"><apex:outputField value="{!con.Owner.Name}" rendered=" {!con.Influence__c = 'High'}"/></td>
                    </tr>
                </apex:repeat>

For some reason it displays no values, even though I know there to be some. When I remove the "rendered" attribute, it works.

I appreciate any help that can be given.

Best Answer

You can use <apex:dataTable tag to get the required output . You can put the rendered attribute for each column based on your condition. Hope this helps.

<apex:page showHeader="true" sidebar="true" standardController="Account" tabStyle="Account">
    <apex:dataTable value="{!Account.Contacts}" var="con" cellPadding="4" border="1">
        <apex:column value="{!con.FirstName}" rendered="{!con.Influence__c=='High'}"/>
        <apex:column value="{!con.LastName}" rendered="{!con.Influence__c=='High'}"/>
        <apex:column value="{!con.Phone}" rendered="{!con.Influence__c=='High'}"/>
        <apex:column value="{!con.Email}" rendered="{!con.Influence__c=='High'}"/>
    </apex:dataTable>
</apex:page>