0

Apex Class

public class outterClass(){
    // set properties
    public List<innerClass> inners {get; set;}

    outterClass(){
        // set inners list values
        inners = new public List<innerClass>{ inner1, inner2};
        for(innerClass inner : inners){
            inner.repeatService = new Component.Apex.Repeat(); // add some value in repeatService 
        }

    }
    
    public class innerClass(){
       // set properties
       public Component.Apex.Repeat repeatService {get; set;}
       public Component.Apex.Repeat getRepeatService(){
           System.debug('Execute get...');
           return this.repeatService;
       }
    }
}

Visualforce page

   <apex:page controller="outterClass">
       <apex:repeat var="inner" value="{!inners}">
           <apex:dynamicComponent componentValue="{!inner.repeatService}"/>
       </apex:repeat>
   </apex:page>

getRepeatService is not executed...Why?

2
  • 1
    Its because you have already defined getter for that. the First line in the innerClass. Also, you have several syntax errors in your code. – Rahul Gawale Sep 3 '20 at 10:21
  • I don't think the error come from the definition of the getter, because i tried to remove the getter but i still get the same result... For the syntax errors, i was just trying to abstract my class. – 84079616ytreza Sep 3 '20 at 10:32
0

I just added invokeAfterAction="true" to my visualforce component and it works.

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.