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
CarlBCarlB 

apex:dynamicComponent in a custom component

Hello.

 

I have a custom component:

 

<apex:component controller="ComponentController">    
  <apex:attribute name="info" type="Info" description="..." required="true" access="public" assignTo="{!lInfo}"/>

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

</apex:component>

 with a custom controller:

 

public with sharing class ComponentController {

	public ApexPages.Component lComponent { 
		get {
			System.debug('HERE100:' + lComponent);
			return lComponent;
		}
		
		private set; 
	}
	
	public Info lInfo {  
		set {
			System.debug('HERE101:' + value);
			info = value;
			
			... do some stuff to calculate lComponent
		} 
		get; 
	}


    public ComponentController() {
    }
    
}

 

When I run it, the getter for lComponent is called before the setter for lInfo.

 

However, if I replace the dynamicComponent element with just {!lComponent}, setter for lInfo is called before the getter for lComponent.

 

Is there any way to force the getter and setter to be called in the correct order when using dynamicComponent?

 

Thanks,

 

Carl