I have an apex:dynamicComponent binded to a pageBlock. In the apex controller, I add dynamic apex components like text boxes, checkboxes and command buttons to a dynamic panelGrid and then add the panel grid to the pageBlock binded to the apex:dynamicComponent.
In a certain case when i click a button (the remove button) present in the dynamic pageBlock I need to remove certain components(textboxes and other fields) rendered on the screen. For doing this, I used an apex action function which is called on click of the 'remove' button. And the action function called another apex function which is supposed to do the do the removing of certain UI components based on the id of the button which is passed as a parameter by the action function.
In this function when I try to access the dynamic pageBlock (which is declared as a public transient data member of the apex controller) I get a reference to null error. Basically the pageBlock value is null.
But when i try to access the dynamic pageBlock in an access function called on a click of a button that is not present within the same dynamic pageBlock but outside the pageBlock, I don't get that error and am able to access its components and values.
Is there any solution to this problem?
I want to access the rendered pageBlockPanel in an action function called from a button click within the panel itself. After I can access the pageBlockPanel, I can remove certain UI Components from it nad then re-Render the pageBlockPanel with only the required values.
Visualforce page having a binding to the apex variable 'pageBlockPanel'.
<apex:dynamicComponent componentValue="{!pageBlockPanel}" id="interviewPanel" />
Declaration of the variable in Apex.
public transient Component.Apex.pageBlock pageBlockPanel{get;set;}