0

I have the following in a VF page:

        <apex:outputPanel id="tstpopup" >
            <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
                <apex:pageBlockTable width="500px" value="{!qbWrapperList}" var="qb" id="qbTable">
                    <apex:column >
                        <apex:facet name="header">Add Question</apex:facet>
                        <apex:selectCheckboxes value="{!qb.isChecked}" id="checkbox" />
                    </apex:column>
                    <apex:column >
                        <apex:facet name="header">Question</apex:facet>                                
                        <apex:outputText value="{!qb.qb.Question__c}" id="question"/>
                    </apex:column>
                    <apex:column >
                        <apex:facet name="header">Answers</apex:facet>
                        <apex:outputText value="{!qb.qb.Answer_Choices__c}" id="answer"/>
                    </apex:column>
                </apex:pageBlockTable>
                <apex:commandButton value="Save" action="{!closePopup}" rerender="tstpopup"/>
                <apex:commandButton value="Cancel" action="{!closePopup}" rerender="tstpopup, qbTable"/>
            </apex:outputPanel>
        </apex:outputPanel>

The Cancel/Save button methods are simple:

public void closePopup() {
    displayPopup = false;
}

If I remove the PageBlockTable from the VF code the closePopup works, but with the PageBlockTable nothing happens.

Any help is appreciated.

******Actually realized that my button calls were not getting to the apex method closePopup. I put a debug statement in the method and didn't see anything in the logs. Any idea why that would not work?

  • can you specify what is the requirement and what is the specific issue – Santanu Boral May 24 '17 at 16:05
  • I have a popup appear and disappear based on rerendering outputpanels. It works if I remove the PageBlockTable. – SkipVV May 24 '17 at 18:16
  • Where is the form without it apex:commandButton can't be added paste the exact code – Avijit Chakraborty May 25 '17 at 14:31
2

Please Check my blog here. If you have a panel with rendered condition you need to wrap with another panel without any condition and rerender it.

<apex:outputPanel id="outerPanel">
<apex:outputPanel rendered="{!someval}" />
</apex:outputPanel>
<apex: form>
 <apex:commandBunnon value ="Test" action ="{!test}" reRended = "outerPanel" />
</apex:form>
  • good info and the blog – Santanu Boral May 24 '17 at 16:34
  • Thanks, but aren't I already doing that? <apex:outputPanel id="tstpopup" > <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/> <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}"> – SkipVV May 24 '17 at 17:56
  • Yes, qbTable is a pageBlockTable if it wrapped with an apex:outputPanel it will work from my experience I know rerendering does not work on pageBlockTable all the time – Avijit Chakraborty May 25 '17 at 14:24
0

Can you please try giving an Id to your nested outputPanels and try to give that Id in Rendered attribute of your command buttons. Below is sample modified code. Please try.

<apex:outputPanel id="tstpopup" >
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}" Id="nestedPanelOne"/>
        <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
            <apex:pageBlockTable width="500px" value="{!qbWrapperList}" var="qb" id="qbTable">
                <apex:column >
                    <apex:facet name="header">Add Question</apex:facet>
                    <apex:selectCheckboxes value="{!qb.isChecked}" id="checkbox" />
                </apex:column>
                <apex:column >
                    <apex:facet name="header">Question</apex:facet>                                
                    <apex:outputText value="{!qb.qb.Question__c}" id="question"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">Answers</apex:facet>
                    <apex:outputText value="{!qb.qb.Answer_Choices__c}" id="answer"/>
                </apex:column>
            </apex:pageBlockTable>
            <apex:commandButton value="Save" action="{!closePopup}" rerender="tstpopup,nestedPanelOne"/>
            <apex:commandButton value="Cancel" action="{!closePopup}" rerender="tstpopup, nestedPanelOne, qbTable"/>
        </apex:outputPanel>
    </apex:outputPanel>
  • Thanks. But that didn't work. – SkipVV May 24 '17 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.