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
Amit GhadageAmit Ghadage 

Can we Iterate over list of Dynamic Components on visualforce page

I need to iterate over list of dynamic components on visualforce page but its not working.
I tried with apex:repeat and apex:pageBlocktable tags on vf, With transient keyword and without transient keyword.

vf page
<apex:page StandardController="Account" extensions="testDynamicComponent "> <apex:form>
 <apex:pageBlock>
 <apex:repeat value = "{!dynamicComponents}" var = "d">
 <apex:dynamicComponent componentValue = "{!d}"/>
 </apex:repeat >
 </apex:pageBlock> 
</apex:form> 
</apex:page>

Controller
public class testDynamicComponent {

    public testDynamicComponent(ApexPages.StandardController controller) {

    }

   public List<Component.Apex.InputField> getdynamicComponents()
    {
            List<Component.Apex.InputField> inputFieldList = new List<Component.Apex.InputField>();

            transient  Component.Apex.InputField inpField= new Component.Apex.InputField();
            inpField.expressions.value = '{!Account.Name}';
            inputFieldList.add(inpField);

            transient  Component.Apex.InputField inpFldIndus = new Component.Apex.InputField();
            inpFldIndus.expressions.value = '{!Account.Industry}';
            inputFieldList.add(inpFldIndus);

            return inputFieldList;
    }

}


 
NagendraNagendra (Salesforce Developers) 
Hi Amit,

May I suggest you please check with below link from stack exchange community with a similar issue on iterating dynamic components inside a controller using page block table. Please let us know if this helps.

Thanks,
Nagendra.