1

So I have a custom Visualforce page that I am using to edit a number of records from a custom object. There is a grid (page block table) for inline editing of multiple records at the same time.

I've noticed two things:

1) I'm unable to override the new and edit tabs for the custom object

2) none of the data is saving

I wrote a custom controller that is return records okay. However, I can't figure out the save function.

    <apex:page controller="APM_OpenChart" sidebar="false">


   public with sharing class APM_OpenChart {

    public List<APM__c> setCon{
        get {
            if(setCon == null) {
                setCon = [SELECT Name, BV_1__c, BV_2__c, BV_3__c, BV_4__c, BV_5__c, TV_1__c, TV_2__c, TV_3__c, TV_4__c, TV_5__c FROM APM__c];
            }
            return setCon;
        }
        private set;
    }

    public List<APM__c> getAPM(){       
        return setCon;       
    }

For clarity, I'm trying to inline edit a series of records using a PageBlockTable all at one time in a list view fashion.

Rapid data entry

2 Answers 2

1

You will need to create a command button that will call a controller that will handle the updates, inserts and upserts.

*This is in conjunction with your earlier question about getters and setters, your controller knows about the variables on your Visualforce page

7
  • Question: would I still keep "standardcontroller" in my apex:page or would that line look like something else? <apex:page standardController="APM__c" extensions="APM_OpenChart" recordSetVar="apps">
    – tjcinnamon
    Commented Jan 27, 2016 at 22:20
  • I'm not sure what your doing, but you most likely will need to build a custom controller
    – EricSSH
    Commented Jan 27, 2016 at 22:30
  • I added a pic. I'm basically editing a number of records all at one time.
    – tjcinnamon
    Commented Jan 27, 2016 at 22:49
  • 1
    Can you post your controllers?
    – EricSSH
    Commented Jan 27, 2016 at 22:54
  • 1
    So I didn't see that you wanted to inline edit it, i've never attempted that but I think there are tutorials on it
    – EricSSH
    Commented Jan 29, 2016 at 20:08
1

In order to save inline edits I could not use <apex:column> and have the value be the variable. I needed to surround them with columns and treat them as OutputFields (who woulda-thunk-it)?

<apex:column headerValue="name">
    <apex:outputField value="{!APM_Apps.name}"/> 
</apex:column>
<apex:column headerValue="BV1">
    <apex:outputField value="{!APM_Apps.BV_1__c}"/> 
</apex:column>

From there I built a basic controller and saved the controller list.

public List<APM__c> setCon{
    get {
        if(setCon == null) {
            setCon = [SELECT Name, BV_1__c, BV_2__c, BV_3__c, BV_4__c, BV_5__c, TV_1__c, TV_2__c, TV_3__c, TV_4__c, TV_5__c FROM APM__c];
        }
        return setCon;
    }
    private set;
}

public List<APM__c> getAPM(){       
    return setCon;       
}

    public PageReference save() {  
        try{
            update this.setCon;
        }catch(exception e){
        }

        PageReference page = new Pagereference('/apex/APM_Entry?sfdc.tabName=01r61000000R7YW');
        page.setRedirect(false);
        return page;
}
1
  • One other item that is important is the private set method, without this the inline edit will not correctly save.
    – Payload
    Commented Jun 24, 2018 at 4:54

You must log in to answer this question.

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