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
SamCousinsSamCousins 

apex:related list not iterating.

Hi all, I have this :

 <apex:pageBlockTable value="{!projectList}" var="c" >
                                             
                                             <div class="rows">
                                             <apex:column headerValue="Title" headerClass="ct">
                                                 <apex:outputLink value="/{!c.id}"><apex:outputText value="{!c.Project_Title__c}" /></apex:outputLink>  
                                             </apex:column>
                                             
                                                <apex:column headerValue="End Date" value="{!c.Project_End_Date__c}" headerClass="ct"/>
                                            
                                             <apex:column headerValue="Open Cases" value="{!c.Open_Cases_TEXT__c}" headerClass="ct"/>
                                             <div id="casesRelated">
                                                 <apex:column headerValue="Cases" headerClass="ct" id="caseCol" rendered="true">
                                                     <apex:relatedList subject="{!c.id}" list="Cases__r"  />
                                                 </apex:column> 
                                             </div>
                                                 
                                             </div>

                                         </apex:pageBlockTable>

However the related list for each row only displays the cases from the very first c.Id! How do I make it iterate with the rows of the pageblocktable? Thanks, Sam!
Best Answer chosen by SamCousins
Shashi PatowaryShashi Patowary
Hi Sam,

You VF page seems ok. Can you please post how you are preparing data in the controller.

Regards,
Shashi

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please try below code. I hope that will help u
<apex:pageBlockTable value="{!projectList}" var="c" >
                                             
	 <apex:column headerValue="Title" headerClass="ct">
		 <apex:outputLink value="/{!c.id}"><apex:outputText value="{!c.Project_Title__c}" /></apex:outputLink>  
	 </apex:column>
	 
	<apex:column headerValue="End Date" value="{!c.Project_End_Date__c}" headerClass="ct"/>
	
    <apex:column headerValue="Open Cases" value="{!c.Open_Cases_TEXT__c}" headerClass="ct"/>
	<apex:column headerValue="Cases" headerClass="ct" id="caseCol" rendered="true">
	 <apex:relatedList subject="{!c.id}" list="Cases__r"  />
	</apex:column> 
</apex:pageBlockTable>
Please let us know if this will help you

 
SamCousinsSamCousins
Hi Amit, what's the difference? Doesn't seem to work.
Shashi PatowaryShashi Patowary
Hi Sam,

You VF page seems ok. Can you please post how you are preparing data in the controller.

Regards,
Shashi
This was selected as the best answer