+ Start a Discussion
jbardetjbardet 

I have a list... now how do I make fields editable?

It would be great if I could not only display the information, but allow users to edit some of the fields (Job #, Delivery Date, Reason for Change / Add'l Notes)

 

<apex:page standardController="Opportunity"  showHeader="false" sidebar="false"  >

<apex:outputText value="Opportunity Jobs" style="font-weight:bold" /> &nbsp; &nbsp;
<br /> 
<p />

<apex:form >
<apex:pageBlock >
<apex:pageblockTable value="{!Opportunity.OpportunityLineItems}" width="100%"  var="ml" border="1"   >
<apex:column >
<apex:facet name="header">Type</apex:facet>
<apex:outputField value="{!ml.Work_Type_NonSynced__c}" />
</apex:column>
<apex:column value="{!ml.Job__c}" />
<apex:column value="{!ml.Drawing__c}" />
<apex:column value="{!ml.Quantity}" />
<apex:column value="{!ml.Delivery_Date_Final__c}" />
<apex:column value="{!ml.Delivery_Change_Reason__c}" />
</apex:pageblockTable>

</apex:pageBlock>
</apex:form>
</apex:page>

 

 

Here's the list, it would be nice if they could edit on the fly! Trying to follow along with this, but thought I'd come here before getting further away from my goal..

 

 

Shashikant SharmaShashikant Sharma

Read about <apex:inlineEditSupport 

see this : http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inlineEditSupport.htm

 

In case if it does not help you

 

read this

http://www.forcetree.com/2009/11/inline-editing-in-visualforce.html

 

I hope one of them help you.

 

 

jbardetjbardet

thank you for pointing me in the right direction! I've been toying with various options for a few hours now.

 

The save button is saving the Opportunity, not the Opportunity Products related list (I get why, just not able to put the solution together). How can I have a Save button above the table that save the OpportunityLineItems?

 

I also tried using quicksave but this didn't actually save the updated data.

 

Also, I noticed I am not able to populate data in the table for the first time, only edit data that is already there. 

 

I'll continue to read the various resources as I await any other hints.

 

Thanks!

 

 

<apex:page StandardController="Opportunity"  showHeader="false" sidebar="false"  >

<apex:outputText value="Opportunity Jobs" style="font-weight:bold" /> &nbsp; &nbsp;
<br /> 
<p />

<apex:form >

 <apex:pageBlock mode="inlineEdit">
            <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" id="save" value="Update Jobs"/>
            <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
      </apex:pageBlockButtons>

<apex:inlineEditSupport >
<apex:pageblockTable value="{!Opportunity.OpportunityLineItems}" width="100%"  var="ml" border="1"   >
            
<apex:column >
<apex:facet name="header">Type</apex:facet>
<apex:outputField value="{!ml.Work_Type_NonSynced__c}" />
</apex:column>
<apex:column value="{!ml.Job__c}" />
<apex:column value="{!ml.Drawing__c}" />
<apex:column value="{!ml.Quantity}" />
<apex:column value="{!ml.Delivery_Date_Final__c}" />
<apex:column value="{!ml.Job_Status__c}" />
<apex:column value="{!ml.Delivery_Change_Reason__c}" />
</apex:pageblockTable>
</apex:inlineEditSupport>

</apex:pageBlock>


</apex:form>
</apex:page>

 

 

 

bob_buzzardbob_buzzard

You'd need to have an extension controller that manages the related list in order to be able to save those records I suspect.  Save/quicksave on a standard controller will save the record that you are editing.  The apex docs are clear that the object graph will not be traversed when a DML insert / update takes place, so I'd imagine the controller behaves in the same way.