You need to sign in to do that
Don't have an account?
Nishi
Inline editing in Visualforce page
Hi,
Whenever a field has to be inline edited then the value gets saved only after clicking outside that area.Is this how the inline edit works in a visualforce page?
Try this method
public PageReference saveMV(){
if(mainViewRec.percent__c!=null){
upsert mainViewRec;
return null;
}
}
All Answers
NO you need to click on save button or enter for save.
for your reference go through this link
http://ap1.salesforce.com/help/doc/en/getstart_inline_editing.htm
Sorry probably my query wasn't clear enough. The values get saved only after clicking outside and then clicking on save. After entering the value if the user doesn't click outside the inline edit area and directly clicks on save then the value isn't getting saved.
Yes the problem is in the visualforce page.Please find the code below
<apex:pageBlock id="pageblock1">
<apex:commandButton value="Save" id="saveButton" action="{!saveMV}" style="font-weight:bold" reRender="pageblock1"/>
<table><tr><td>
<apex:outputLabel value="Price Increase" style="font-weight:bold;"/></td>
<td style="background-color:#D0F5A9">
<apex:outputField value="{!mainViewRec.percent__c}" >
<img src="/s.gif" alt="Help" class="helpIcon" title="Double click to Edit the field."/>
<apex:inlineEditSupport event="ondblclick" />
</apex:outputField>
</td></tr></table>
</apex:pageBlock>
Actually I can't figure it out, Still try this,
<apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton">
Let me know If it works otherwise share your controller method.
It did not help. Please find the controller code below:
public class testController {
public Main_View__c mainViewRec{get;set;}
String currentAccountId;
public testController(ApexPages.StandardController controller) {
mainViewRec = new Main_View__c();
currentAccountId = ApexPages.currentPage().getParameters().get('id');
List<Main_View__c> lst = new List<Main_View__c>();
lst = [Select Account__c,percent__c from Main_View__c where Account__c=:currentAccountId];
if(lst!=null && lst.size()>0){
mainViewRec = lst[0];
}
}
public void saveMV(){
if(mainViewRec.percent__c!=null){
mainViewRec.Account__c = currentAccountId;
upsert mainViewRec;
}
}
}
Try this method
public PageReference saveMV(){
if(mainViewRec.percent__c!=null){
upsert mainViewRec;
return null;
}
}