<apex:dynamicComponent componentValue="{!DynamicPicklist}"/>


public List<MyWrapperClass> lstPicklistValues{get;set;}
public Component.Apex.repeat getDynamicPicklist() {
        Component.Apex.repeat myDetailList= new Component.Apex.repeat(var='l');
        myDetailList.expressions.value = '{!lstPicklistValues}';

        Component.Apex.OutputLabel theLevelLabel = new Component.Apex.OutputLabel();
        theLevelLabel.value = '{!l.level.Value__c}';


        return myDetailList;

The above code displays as below,

{!l.level.Value__c} {!l.level.Value__c} {!l.level.Value__c} {!l.level.Value__c} {!l.level.Value__c}

Its not fetching value instead its hardcoded with '{!l.level.Value__c}'

please help! i am stuck with this since long time

  • hi @KeithC can you solve this issue? – snehakem Jun 2 '15 at 12:40
  • When Apex code such as your getDynamicPicklist method executes there is no {!} substitution mechanism or context available: that is only available in a Visualforce page or component. I suggest looking for a non-dynamic component solution; if you can't find one your can post another question that explains what you are trying to accomplish. – Keith C Jun 2 '15 at 12:51
  • that means dynamic component doesnt work with apex repeat. i feel like there has to be some way. because i didnt find apex:repeat in dynamicComponent not supported list. – snehakem Jun 2 '15 at 12:56
  • Also i tried it by referring this salesforce.com/docs/developer/pages/Content/… – snehakem Jun 2 '15 at 13:08
  • 1
    I've found dynamic components to be too flawed to use. For example, when there are input fields and a validation error occurs the current values are lost because dynamic components can't be serialized into the view state. – Keith C Jun 2 '15 at 13:28

theLevelLabel.expressions.value = '{!l.level.Value__c}';

  • Bryan, you'd clear up your answer if you also explain it. – Samuel De Rycke Jul 30 '15 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.