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. Commented Sep 3, 2020 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. Commented Sep 3, 2020 at 10:32

1 Answer 1

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .