4

I've been searching for a simple example but I think those that I've found were too big or didn't answer my question on its main point so here it goes.

My question is if it's possible to inline edit field(s), which are listed through columns. My problem is how to find the Id of the field which was double-clicked, since, for example, I am viewing a record of an object of type A. In the view of type A, I'm listing records from both B and C type records. From what I've been able to implement, I'm only able to edit the rows from the type A object because that's the only Id parameter I've been able to fetch.

Is it possible to inline edit rows from type B and C objects on a view from type A object?

Best Regards

   <apex:form >
<apex:pageBlock mode="maindetail">
  <apex:pageBlockButtons >
    <apex:commandButton action="{!edit}" id="editButton" value="Edit" />
    <apex:commandButton action="{!save}" id="saveButton" value="Save" />
    <apex:commandButton onclick="resetInlineEdit()" id="cancelButton"
      value="Cancel" />
  </apex:pageBlockButtons>
  <apex:pageBlockSection >
        <apex:pageBlockTable value="{!selectValueFromCustomObject}" var="item" 
            <apex:column headerValue="Name" value="{!item.Name__c}"/>
        </apex:pageBlockTable>
      <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
        hideOnEdit="editButton" event="ondblclick"
        resetFunction="resetInlineEdit" />
  </apex:pageBlockSection>
</apex:pageBlock>
  • Hi Rui, I'm finding it a bit hard to follow your question with the A's, B's and C's. Could you give a short code sample or screenshot to help us understand what your VF looks like and what you're trying to accomplish? – Benj Sep 30 '13 at 16:59
  • Added some code. The case here is shown with the Standard definitions of !save and !cancel, because I don't know how to retrieve the ID of the field I double click. I can edit, undo it, and all those things, but when updating it (pressing Save button) it doesn't change anything and simply returns to the old value. – Rui Rocha Sep 30 '13 at 17:06
2

You are on the right track, There is a section in the VF workbook that addresses this very thing. You can use this section of the workbook from Salesforce Visualforce documentation. This is exactly what you are trying to accomplish, and it takes care of the identification of which row to update for you.

This should give you the exact functionality you are looking for

http://www.salesforce.com/us/developer/docs/workbook/Content/visualforce_6.htm

| improve this answer | |
  • Hi, thanks for the answer, though I'm afraid it won't be able to solve my problem. Isn't quicksave a standard command? I've tried this workbook example but it didn't work and I think it shouldn't, because I'm trying to edit object B and C while listing them on the view of the object A, this probably only works in the update of the object while in its View. – Rui Rocha Oct 1 '13 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.