+ Start a Discussion

Apex Dynamic Component reRender issue


I have a Visualforce Component that just contains a button, and performs an Apex Controller action, and reRenders a part of the Component.

VF Component:

<apex:form id="formId">

String reRendered oncomplete: {!reRenderedTextValue}

<apex:commandButton value="ClickButton" action="{!someAction}" reRender="formId" />



This Component works absolute fine when I include it in a VF page in a static way like: <c:MyComponent />

The value of the text in the reRendered postion is refreshed.

But when I include the component using an apex:dynamicComponent like this:


public Component.Apex.OutputPanel getDynamicPanel() 
Component.Apex.OutputPanel op = new Component.Apex.OutputPanel ();
Component.Apex.PageBlock pBlock = new Component.Apex.PageBlock();
pBlock.childComponents.add(new Component.MyComponent());
return op;


In the VF Page:

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

In this VF Page, when I click the Button, the 'reRender' in the MyComponent does not work at all.

Could any1 help me here?



Andrew WilkinsonAndrew Wilkinson

For a start you should compare the source of the rendered vf pages doing it both ways. This would give you a good idea of what component isn't being rendered correctly.




Yes I have already done that. I've compated the sources on both VF pages, and the forms and IDs are rendered exactly the same.

I however circumvented the solution by using a standard HTML button with Javascript Remoting.