+ Start a Discussion
Christopher PezzaChristopher Pezza 

How to rerender a outputPanel once data is submitted

So I want to perform a search and then return the results on that same screen with rerender on an outputpanel but it never returns results heres my code what am i missing.
Public List<LLC_BI__Loan__c> AddLoans {get;set;}
public String LoanSearch {get;set;}
Public Boolean SearchStatus {get;set;}

public void SeachLoans() {
        String BuildSearch;
        system.debug('**' + LoanSearch);
        BuildSearch = '\'%' + LoanSearch + '%\'';
        system.debug('**' + BuildSearch );
        AddLoans = [SELECT Id, Name, LLC_BI__Account__c, LLC_BI__Account__r.Name, LLC_BI__lookupKey__c FROM LLC_BI__Loan__c WHERE Name LIKE :BuildSearch];
        system.debug('**' + AddLoans );
        this.SearchStatus = true;
        system.debug('**' + SearchStatus );
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="LoanModal">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel">Attach A Loan to this Deal Facility</h4>
                </div><!-- /.modal-header -->
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-offset-2 col-md-8">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Loan Name:
                                    <apex:inputText value="{!LoanSearch}" styleClass="form-control"/>
                                    <span class="input-group-btn">
                                        <apex:commandButton value="Search" action="{!SeachLoans}" styleClass="btn btn-success" reRender="LoansList">
                                            <apex:param value="{!LoanSearch}"/>
                                </div><!-- /input-group -->
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                    <div class="row">
                        <div class="col-md-12">
                            <table class="table table-responsive table-hover" id="AddLoanTable">
                                        <th>Loan Name</th>
                                        <th>Loan Number</th>
                                        <th>Relationship Name</th>
                                    <apex:outputPanel id="LoansList" rendered="{!SearchStatus}">
                                        <apex:repeat value="{!AddLoans}" var="fa">
                                                    <apex:commandButton value="Add" StyleClass="btn btn-xs btn-success">
                                                        <apex:param value="{!fa.Id}"/>
                                                <td><a href="/{!fa.Id}" target="_Blank">{!fa.Name}</a></td>
                                                <td><a href="/{!fa.LLC_BI__Account__c}" target="_Blank">{!fa.LLC_BI__Account__r.Name}</a></td>
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.modal-body -->
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

Vikash TiwaryVikash Tiwary
I see that you are rerendering outputpanel with Id 'LoansList' which also have rendered attribute in it. It is Salesforce known issue that rerender and rendered do not work together on same outputpanel. For its fixture, enclose outputpanel with rendered attribute in separate another outputpanel and rerender outer outputpanel. Hope i am clear.

Please let me know if this works.