1

VF

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

Apex

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}';

        myDetailList.childComponents.add(theLevelLabel);

        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

5
  • 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
-2

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

1
  • 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.