function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
stollmeyerastollmeyera 

Saving a table with inline editing

I have a VF table that displays on an Opportunity, but pulls in all of the contacts related to the parent Account of that Opportunity.  In that same table I have inline editing, but I can't seem to find a way to save these edits.  Below is my page:

<apex:page standardController="Opportunity" extensions="AccountContacts" tabstyle="Contact" showHeader="false" sidebar="false">
    <apex:form >
        <center>
            <apex:commandButton value="Save" style="width:140pt; heigth:30pt;" action="{!save}"/>
            <apex:commandButton value="Cancel" action="cancel"/>
        </center>
        <apex:pageBlock >
            <apex:pageBlockTable value="{!contacts}" var="c" title="Contacts" cellpadding="20px" >
                <apex:column headerValue="Name">
                    <apex:outputLink value="/{!c.ID}" target="_parent">{!c.FirstName} {!c.LastName}</apex:outPutlink>
                </apex:column>
                <apex:column headerValue="Phone">
                    <apex:outputField value="{!c.Phone}"> 
                        <apex:inlineEditSupport event="ondblclick" showOnedit="update"/> 
                    </apex:outputField>
                </apex:column>
                <apex:column headerValue="Email">
                    <apex:outputField value="{!c.Email}"> 
                        <apex:inlineEditSupport event="ondblclick" showOnedit="update"/> 
                    </apex:outputField>
                </apex:column>
                <apex:column headerValue="Role">
                    <apex:outputField value="{!c.Role__c}"> 
                        <apex:inlineEditSupport event="ondblclick" showOnedit="update"/> 
                    </apex:outputField>
                </apex:column>
                <apex:column headerValue="Role2">
                    <apex:outputField value="{!c.Secondary_Role__c}"> 
                        <apex:inlineEditSupport event="ondblclick" showOnedit="update"/> 
                    </apex:outputField>
                </apex:column>
                <apex:column headerValue="Role3">
                    <apex:outputField value="{!c.Tertiary_Role__c}"> 
                        <apex:inlineEditSupport event="ondblclick" showOnedit="update"/> 
                    </apex:outputField>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Below is my extension:

 

public class AccountContacts{
    ApexPages.StandardController controller;
    private final Opportunity opp;
    public AccountContacts(ApexPages.StandardController controller) {
        opp=(Opportunity)controller.getrecord();
        this.controller = controller;
    }

    // Create the list for existing contacts
    public List<Contact> getContacts() {
        List<Opportunity> opps = [Select ID, AccountID
                                  FROM Opportunity
                                  WHERE ID =:ApexPages.currentPage().getParameters().get('ID')
                                  limit 1];
        string ActID = opps[0].AccountID;
        List<Contact> contacts = [select id, AccountID, FirstName, LastName, Phone, Email, Question_Answer__c, Role__c, Secondary_Role__c,Tertiary_Role__c, Create_Profile__c
                    from Contact
                    Where AccountID =:ActID
                    ORDER BY LastName];
        return contacts;
    }
    
    public PageReference save() {
        controller.save();
        PageReference contPage = new PageReference('/apex/accountcontacts?id=' + opp.ID);
        contPage.setRedirect(true);
        return contPage;
    }
}

 

I have tried adding a simple "update contacts;" to my PageReference to no avail.

 

How can i get the Save function to save the contacts as well?