You need to sign in to do that
Don't have an account?
Custom list controller Save method - not updating records
I've written a controller extension for a standardset controller driven Visualforce Page. I've include a custom 'Save and Close' button that saves the records and closes the page. However - it isn't updating the list I've called in the constructor. Here is the controller extension and vforce page - limited to just the basics - any assistance would be great.
Controller extension:
public with sharing class InEditExtensionOne {
//Global Variables
private ApexPages.StandardSetController controller;
Private final string InEditUser=UserInfo.getUserId();
public list<Case> InEdit { get; set; }
public String onClick { get; set; }
// Standard Controller Constructor
public InEditExtensionOne(ApexPages.StandardSetController Controller) {
this.controller = controller;
this.InEdit=[SELECT Id,CaseNumber,Account.Name,Account.Id,Description,Subject,ButtonClick__c FROM Case WHERE InEditUser__c =: InEditUser];
}
//Save and Close method
public PageReference SaveClose(){
for(Case g :InEdit){
g.ButtonClick__c=onClick;
}
update InEdit;
PageReference pageRef = new PageReference('/500/o');
pageRef.setRedirect(true);
return pageRef;
}
}
VForce Page
<apex:page standardController="Case" extensions="InEditExtensionOne"
recordSetVar="implementations">
<apex:sectionHeader title="New Field Values"/>
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Save and Close"
action="{!saveClose}" onclick="NoPrompt();"/>
<apex:commandButton value="Save and Next"
action="{!saveNext}" onclick="NoPrompt();"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Input Fields" showHeader="false"
collapsible="false">
<apex:inputField value="{!Case.AccountId__c}"/>
<apex:inputField value="{!Case.Subject__c}"/>
<apex:inputTextArea value="{!Case.Description__c}" rows="5" cols="75"/>
<apex:inputField Label="ButtonClick" value=""{!onClick}">
</apex:pageBlockSection>
<apex:pageBlockSection title="Selected Implementations" columns="1">
<apex:pageBlockTable value="{!InEdit}"
var="c">
<apex:column headerValue="Case No">
<apex:outputLink value="/{!c.id}">{!c.casenumber}</apex:outputLink>
</apex:column>
<apex:column value="{!c.Account.Name}"/>
<apex:column value="{!c.Subject}"/>
<apex:column value="{!c.Description}"/>
<apex:column value="{!c.ButtonClick__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Thanks
Sandeep Singhal