You need to sign in to do that
Don't have an account?
Vidya Rani
"Save" not working on Standard list using Inline Edit
I am trying to display list of Accounts using Standard controller and allow inline edit of records displayed. The Save button I have added is not working/saving the udpate in database. Can someone please help, what m I missing
Do I need to write extension for this?
Code piece:
<apex:page standardController="Account" recordSetVar="Account"> <!-- extensions="myControllerExtension"> -->
<apex:form >
<apex:pageBlock title="Account Summary" mode="inlineEdit">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
<apex:commandButton action="{!quicksave}" id="saveButton" value="Save" rendered="true"/>
<apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel" rendered="true"/>
<apex:pageBlockTable value="{! Account}" var="at">
<apex:column value="{! at.Name }"/>
<apex:column value="{! at.Phone}"/>
<apex:column value="{! at.Industry}"/>
<apex:column value="{! at.AnnualRevenue }"/>
<apex:column value="{! at.Id }"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Do I need to write extension for this?
Code piece:
<apex:page standardController="Account" recordSetVar="Account"> <!-- extensions="myControllerExtension"> -->
<apex:form >
<apex:pageBlock title="Account Summary" mode="inlineEdit">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
<apex:commandButton action="{!quicksave}" id="saveButton" value="Save" rendered="true"/>
<apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel" rendered="true"/>
<apex:pageBlockTable value="{! Account}" var="at">
<apex:column value="{! at.Name }"/>
<apex:column value="{! at.Phone}"/>
<apex:column value="{! at.Industry}"/>
<apex:column value="{! at.AnnualRevenue }"/>
<apex:column value="{! at.Id }"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Use this code in your pageblocktable:
All Answers
Use this code in your pageblocktable:
You can List Controller for the same.Refer below sample code for opportunities.
If you want to use custom controller then refer below link which has sample code.
https://www.linkedin.com/pulse/how-do-inline-edit-custom-visualforce-page-ravi-kant
Please mark it as Solved if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards
Sandhya
This code edit and save successfully and check updated account in referring.
Please check below code I hope you understand this.
<apex:page standardController="Account" recordSetVar="records" id="thePage" tabStyle="Account">
<apex:form id="theForm">
<apex:pageBlock id="thePageBlock" title="Account Summary" mode="inlineEdit">
<apex:pageBlockTable value="{!records}" var="at" id="thePageBlockTable">
<apex:column >
<apex:outputField value="{!at.Name}"/>
<apex:facet name="header">Name</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!at.Phone}"/>
<apex:facet name="header">Phone</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!at.Industry}"/>
<apex:facet name="header">Industry</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!at.AnnualRevenue}"/>
<apex:facet name="header">Annual Revenue</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!at.Id}"/>
<apex:facet name="header">AccountId</apex:facet>
</apex:column>
<apex:inlineEditSupport event="ondblClick"
showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
</apex:pageBlockTable>
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!save}" id="editButton" />
<apex:commandButton value="Save" action="{!save}" id="saveButton" />
<apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Thank You
Ajay Dubedi