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
JAW99JAW99 

Filtering a display of related objects in a VF page

I am trying to pull a filted list on a VF page but am thinking that the VF pageBlockTable cannot filter properly. Is there an Apex alternative to the following code with an option that would only return records with a specified value in a specified field? Thanks

 

<apex:page standardController="Account" >
<apex:pageBlock >

<apex:form >

<apex:pageBlockTable value="{!account.Contracts}" var="Contract">

<apex:column headervalue="Contract Number">
<apex:outputLink value="https://na2.salesforce.com/{!Contract.id}"  target="_top" id="theLink">{!Contract.contractNumber}</apex:outputLink>
</apex:column>

<apex:column value="{!Contract.Contract_Type__c}"/>

<apex:column value="{!Contract.status}"/>
<apex:column value="{!Contract.ownerid}"/>    
  
<apex:column value="{!Contract.ActivatedDate}"/>

</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>


</apex:page>

 

spraetzspraetz

You could use a custom controller or an extension controller to grab the Account's contacts and filter them in Apex code.