I'm having an issue trying to use dynamicComponent
. I'm trying to display an outputPanel, but getting a SerializationException. I'm trying to accomplish this with the following code:
In my page I have a button that calls the goPlatform1 method as the action:
<apex:commandButton value="Go Platform1" action="{! goPlatform1 }" reRender="mainPanel"
disabled="{! isPlatform1Disabled }" />
With the idea that it's going to populate a variable called featurePanel:
public Component.Apex.OutputPanel goPlatform1() {
featurePanel = ( (PlatformFeature)t1.newInstance() ).getFeaturePanel();
return null;
}
Used by a dynamicComponent
tag:
<apex:dynamicComponent componentValue="{! featurePanel }" id="mainPanel" />
The getFeaturePanel()
looks like this:
global Component.Apex.OutputPanel getFeaturePanel() {
Component.Apex.OutputPanel outPanel = new Component.Apex.OutputPanel();
Component.Apex.PageBlock pgBlock = new Component.Apex.PageBlock();
pgBlock.id = 'platform1Block';
pgBlock.title = 'Platform 1 PageBlock';
outPanel.childComponents.add(pgBlock);
return outPanel;
}
This produces a System.SerializationException: Not Serializable: Component.apex.outputpanel
message on the VF page.