0
<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" 
            value="{!customerDetails.KUNNR__c}"/>
        <apex:outputText label="Address" 
            value="{!customerDetails.Street_1__c} 
                   {!customerDetails.Street_1__c} 
                   {!customerDetails.Street_2__c} 
                   {!customerDetails.Town__c} 
                   {!customerDetails.State__c} 
                   {!customerDetails.District__c} 
                   {!customerDetails.PIN_code__c}"/><br/>
        <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" 
            action="{!generateSDSAccountDetails}" 
            styleClass="btn btn-primary btn-sm" reRender="pbssdsacc"/>
    </apex:pageBlockSection> 
    <apex:outputPanel>
        <apex:pageBlockSection rendered="{!sdsAccountGenerateReport}">
            Customer Name
        </apex:pageBlockSection>
    </apex:outputPanel>                                 
</apex:outputPanel> 

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

5
  • 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, 2017 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 Feb 10, 2017 at 7:46
  • 1
    Is sdsAccount a Boolean
    – Eric
    Feb 10, 2017 at 8:10
  • It would be better if yu can share your controller code. Feb 10, 2017 at 8:37
  • @Eric Yes sdsAccount is a Boolean Feb 10, 2017 at 9:22

1 Answer 1

1

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
    </apex:pageBlockSection>
</apex:outputPanel>                                 

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .