0

On click of case id link ..I want to display section under casecommentsList Outputpanel..But section is not displaying...On click of CaseId..action function(sendRequestId) is called....which in turn calls (showRequestSection) method in the controller where i am setting showsection variable to true..But showSection variable is false on visualforce page.I am rendering outputpanel based on showSection variable.

Visualforce Page

 <apex:outputPanel id="requestsList">
                <div class="row">
                <div class="col-md-6 col-sm-12" style="border-left: solid #DDD 1px">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>Description</th>
                                <th>Category</th>
                                <th>Location</th>
                                <th>Request Date</th>
                            </tr>
                        </thead>
                        <tbody>
                            <apex:repeat value="{!Requests}" var="request">
                                <tr>
                                    <td><a onclick="currentRequest = '{!request.Id}'; sendRequestId('{!request.Id}');" >{!request.Subject}</a><input type="Hidden" value="{!request.Id}" id="caseId"/></td>
                                    <td>{!request.Type}</td>
                                    <td>{!request.Location__r.Name}</td>
                                    <td>
                                        <apex:outputText value="{0,date,MM/dd/yyyy}" >
                                            <apex:param value="{!request.CreatedDate}"/>
                                        </apex:outputText>
                                    </td>
                                </tr>
                            </apex:repeat>
                        </tbody>
                    </table>
                    </div>
                    <apex:outputPanel id="CaseCommentsList" rendered="{!showSection}">
                    <div class="col-md-6 col-sm-12" style="border-left: solid #DDD 1px">
          <h4 style="margin-top: 40px">Request Transcript</h4>

            <apex:repeat value="{!Comments}" var="comment">
            <div class="panel panel-default">
            <div class="panel-body">
              {!comment.CommentBody}
             </div>
          <div class="panel-footer"> 
              {!comment.CreatedBy.Name} - {!comment.CreatedDate}
           </div> 
         </div>
          </apex:repeat>

          <div class="panel panel-default">
            <div class="panel-heading">
              <h3 class="panel-title">Update / Comment / Reply</h3>
            </div>
            <div class="panel-body">
            <apex:form id="newCaseComment">
              <form method="POST">
                <div class="form-group">
                   <apex:inputTextarea styleclass="form-control" id="messag" html-placeholder="Message" required="true">
                   </apex:inputTextarea>
                  </div>
                <div class="form-group">
                  <table>
                                        <tr>
                                            <td>
                                                <button type="button" class="btn btn-default" onclick="createCommentForm();" rerender="CaseCommentsList">
                                                Submit
                                                </button>
                                            </td> 

                                            <!-- --------------------------------------------------------------------------- -->
                                            <!-- Status messages -->
                                            <td>
                                                <div id="commentMessages">
                                                    <apex:outputPanel id="commentMessages" >
                                                        <apex:messages layout="table" style="text-align:center;color:#FF0000;" />
                                                    </apex:outputPanel>
                                                </div>
                                            </td> 
                                       </tr>
                                    </table>
                </div>
              </form>
              </apex:form>
            </div>
          </div>

        </div>
       </apex:outputpanel>
      </div>

                </apex:outputPanel>

Controller

public without sharing class RequestsController {

    public RequestsController(){
        showSection = false;
        system.debug('.....showSection.....'+ showSection);
    }

    public Boolean showSection{get;set;}
    public Id cId {get;set;}

    public pagereference showRequestSection() {
        showSection = true;
        system.debug('....showSection...'+showSection);
        return null;
    }

    public list<CaseComment> getComments(){
        System.debug('cId: ' + cId);
        // showSection = true;
       system.debug('....showSection...'+showSection);
       return[Select c.Parent.Subject, c.ParentId, c.Id,c.LastModifiedDate,c.CreatorName,c.CommentBody,c.CreatedBy.Name,c.CreatedDate,c.CreatedById From CaseComment c where c.ParentId = : cId order by c.CreatedDate];

    }
}
1
  • 6
    Hi sf.dev, what exactly are you asking? Can you also try tidy up your code so that its clear which is the Visual Force page and which is the controller. Thanks
    – BarCotter
    Nov 18, 2013 at 23:01

1 Answer 1

1

You should put the <apex:outputPanel> that has the rendered attribute inside of another <apex:outputPanel> and then rerender the outer one:

<apex:outputPanel id="RerenderMe">
    <apex:outputPanel rendered="{!setThisBooleanToTrueBeforeRerender}">
        Content you want displayed
    </apex:outputPanel>
</apex:outputPanel>

You must log in to answer this question.

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