+ Start a Discussion

Standard Set Controller and Child Relationships

How do I work with child relationships in a standard set controller with dynamic visualforce? Here is what I was trying to do. This is not a working example (it throws a system.security.NoAccessException: Object type not accessible. error) but I was hopping I was close to what needs to be done. I know I can write apex to get what I need with the child relationship but I'm trying to use the native power of visualforce. 


<<< The Page >>>
<apex:page standardController="myObj__c" extensions="myObjExtension" recordSetvar="myObj">
<apex:listViews type="myObj__c">
    <apex:facet name="body">
            <apex:repeat value="{!MySetController.Records}" var="pv">
                <apex:outputLabel value="{!pv['name']}" />
                <apex:repeat value="{!pv['Relationship__r']}" var="cv">
                    <apex:outputLabel value="{!cv['foo']}" />

<<< The Extension >>>
public class myExtension {

    public ApexPages.StandardSetController mySetController { get; set; }
    public myExtension(ApexPages.StandardSetController controller) { 
	mySetController = controller;
	mySetController.addFields(new String[{'name','Relationship__r.foo'});


Any thoughts or opinions would help.


<apex:page standardController="Case">
<apex:sectionHeader title="http://www.salesforce.com" subtitle="Related List Example"/>
<apex:pageBlockTable value="{!Case.Childs__r}" var="child">
    <apex:column headervalue="Name"><apex:outputLink value="/{!child.id}">{!child.name}</apex:outputLink></apex:column>
    <apex:column value="{!child.detail__c}"/>
    <apex:column value="{!child.is_active__c}"/>
    <apex:column value="{!child.createddate}"/>
    <apex:column value="{!child.createdbyId}"/>

Kiran, your example is not dynamic nor is it using a standard set controller. Thanks anyhow.


Anyone else?