I have the problem that my editable table does not update when I hit the "save" button. I tried inline editing and normal editing, nothing would save. Although I referred to a standard controller, I prefer the solution with a custom controller.
<apex:page standardController="Dev_Request__c" extensions="tableDevRequest_edit">
<apex:form >
<apex:pageblock mode="inlineEdit">
<apex:pageMessages />
<apex:pageBlockButtons >
<!--<apex:commandButton value="Save" action="{!saveTable}" id="saveButton" rendered="{!editTable==true}" immediate="true"/>-->
<apex:commandButton value="Save" action="{!saveTable}" id="saveButton" immediate="true"/>
<apex:commandButton id="cancelButton" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageblocktable value="{!lstDevRequest_edit}" var="item">
<apex:column headerValue="Dev Request Name"><apex:actionRegion ><apex:outputField value="{!item.Name}"><apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" /></apex:outputField></apex:actionRegion></apex:column>
<apex:column headerValue="Id"><apex:outputField value="{!item.Id}"/></apex:column>
<apex:column headerValue="Status"><apex:inputField value="{!item.Status__c}"/></apex:column>
<apex:column headerValue="Start Date"><apex:inputField value="{!item.Start_Date__c}"/></apex:column>
<apex:column headerValue="Due Date QA"><apex:inputField value="{!item.Due_Date_QA__c}"/></apex:column>
<apex:column headerValue="Estimated Hours"><apex:inputField value="{!item.Estimated_Hours__c}"/></apex:column>
<apex:column headerValue="Assignee"><apex:inputField value="{!item.Assignee__c}"/></apex:column>
<apex:column headerValue="Overview"><apex:inputField value="{!item.Overview__c}"/></apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
public with sharing class tableDevRequest_edit {
public List<Dev_Request__c> lstDevRequest_edit {get;set;}
public tableDevRequest_edit(ApexPages.StandardController controller) {
lstDevRequest_edit = [Select Id, Name, Assignee__c, Assignee__r.Name, Start_Date__c, Due_Date_QA__c, Estimated_Hours__c, Estimated_Completion_Date__c, Status__c, Overview__c from Dev_Request__c];
}
public PageReference saveTable() {
try {
update lstDevRequest_edit;
}
catch(Exception e){
System.debug('Exception occurred '+String.valueOf(e));
}
return NULL;
}
}
Thank you for helping!