0

I have a page that iterates a list object to display the records. Once clicked on save, I updated the same list with new values and debug logs shows the update list but output panel is not rerender'ed and I dont see updated list on VF page.

<apex:outputLabel >A  </apex:outputLabel>
        <apex:inputfield id="idAText" value="{!ttlookup.A}" />
      <apex:inputCheckbox id="checkBoxTMId" value="{!Acheckbox}"/>
      <apex:outputLabel > Check if you want to clear all values 
</apex:outputLabel>

    <apex:commandButton id="btnSave" value=" Save " action="{!Save}" reRender="idPanel" />

 <apex:outputPanel ID = "idPanel">
        <div class="container">   
            <table>
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Type</th> 
                        </tr>
                    </thead>
                    <tbody>
                        <apex:repeat value="{!ryList}" var="tt">
                                <tr>
                                    <td>{!tt.name}</td>
                                    <td>{!tt.Type__c}</td>
                                </tr>
                        </apex:repeat>
                    </tbody>
            </table> 

Controller code:

 public void save(){
    Boolean noUpdateFlag = false;
    for(MyObjec ttry: ryList){
        if(ttlookup.A !=null){
            noUpdateFlag = true;
            ttry.name = ttlookup.A;
        }

        if(Acheckbox){
            noUpdateFlag = true;
            ttry.name = null;
        }

    }
    system.debug(ryList[0].B + ' noUpdateFlag '+noUpdateFlag);
    try{
        if(noUpdateFlag){
            update ryList;
            ApexPages.addmessage(new Apexpages.message(apexpages.severity.CONFIRM, 'records are saved.'));
        }
        else
            ApexPages.addmessage(new Apexpages.message(apexpages.severity.Info, 'no value entered '));
    }catch(Exception ex){
        System.debug(ex);
        ApexPages.addmessage(new Apexpages.message(apexpages.severity.Error, 'Something went wrong'));
    }

}

and moreover when I add reRender = "id.." my apex messages are not displayed. I have no clue why :( any inputs please?

10
  • Share controller code as well. Oct 22, 2018 at 8:47
  • @TusharSharma I have updated the post
    – Mentee
    Oct 22, 2018 at 8:51
  • Where are you updating name , Type__c in save method? Oct 22, 2018 at 9:11
  • @PragatiJain ttry.A = ttlookup.A; this how i am updating. ryList that displays in UI. I have also update post
    – Mentee
    Oct 22, 2018 at 9:14
  • 1
    Thanks @PragatiJain You are right I wasn't updating the list. found the issue and fixed it. please post I will mark it
    – Mentee
    Oct 23, 2018 at 6:44

1 Answer 1

0

VF page code looks good. Rerender should work properly. It looks like you are not updating the list. So please update the list in a proper way and check the result.

1
  • I was update it but It contains only ID not the name so I had to query and update the list by name and type. It worked now. It strick my mind when you commented that I might not have updated the list. Thanks @Pragati Jain
    – Mentee
    Oct 23, 2018 at 17:07

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.