<apex:commandButton value="SDS Account" action="{!fetchSDSAccountDetails}" 
    styleClass="btn btn-primary btn-sm" 
    reRender="pbstracc,pbssdsacc" status="sdsAccButton"/> 

<apex:outputPanel id="pbssdsacc">
    <apex:pageBlockSection rendered="{!sdsAccount}" columns="2" >
        <apex:outputText label="Customer" value="{!customerDetails.Name}"/>
        <apex:outputText label="Customer Code" 
        <apex:outputText label="Address" 
        <apex:input type="date" label="From Date " 
            value="{!accountFromDate}" style="width:120px;font-size:12px" />
        <apex:input type="date" label="To Date " 
            value="{!accountToDate}" style="width:120px;font-size:12px" />
        <apex:commandButton value="Generate Report" 
            styleClass="btn btn-primary btn-sm" reRender="pbssdsacc"/>
        <apex:pageBlockSection rendered="{!sdsAccountGenerateReport}">
            Customer Name

Onclick of SDS Account button I want to rerender pbssdsacc which is working fine. But on click of Generate Report I want to show the pageblock section which is not displayed on click of SDS Account button but displayed on click of Generate Report button

  • Difference I can see is your SDS Account is not rerendering component with name 'pbstracc'. Also you should check if you are setting appropriate condition in generate button function which sets rendered condition. – Raul Feb 10 '17 at 7:29
  • Hi Tushar, pbstracc is for rendering another outputpanel not mentioned here. In the command button i wrote a debug statement to see whether the method is called or not. The method is getting called but not displaying the debug statement when i checked in debug logs. Is the above code correct – Amit Visapurkar Feb 10 '17 at 7:46
  • 1
    Is sdsAccount a Boolean – Eric Feb 10 '17 at 8:10
  • It would be better if yu can share your controller code. – Tushar Sharma Feb 10 '17 at 8:37
  • @Eric Yes sdsAccount is a Boolean – Amit Visapurkar Feb 10 '17 at 9:22

You need following change to your code. You need to give id to parent outputPanel of your pageBlockSection

<apex:outputPanel id="pageBlockSectionParentDiv">
    <apex:pageBlockSection rendered="{!sdsAccountGenerateReport}">
        Customer Name

and then you should use that id in rerender comma separated list

<apex:commandButton value="Generate Report" 
        styleClass="btn btn-primary btn-sm" reRender="pbssdsacc,pageBlockSectionParentDiv"/>

Please vote up and mark answer as accepted if this works for you

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.