function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
merthenmerthen 

edit multiple rows in visualforce page

I would like to build a visualforce page that would pull a collection of objects(same kind of objects) by query onto the page and have each object's fields editable.  The rows would be the objects and each column would represesnt an editable field. A single "Update" or "Save" button would write the changing values back to the appropriate objects.

 

I have tried using a custom controller to pass the objects to the page (works when using read-only apex "column" tags) but when I put the fields into "inputFields" within the apex dataTable, nothing displays. 

 

Any help here?

Ron HessRon Hess

here you go, taken from the docs:

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_edit_data.htm

 

 

 

<apex:page standardController="Opportunity" recordSetVar="opportunities" tabStyle="Opportunity" sidebar="false"> <apex:form > <apex:pageBlock > <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!opportunities}" var="opp"> <apex:column value="{!opp.name}"/> <apex:column headerValue="Stage"> <apex:inputField value="{!opp.stageName}"/> </apex:column> <apex:column headerValue="Close Date"> <apex:inputField value="{!opp.closeDate}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

merthenmerthen

Thanks for the reply:

Two more questions:

1.  how do you pass the list of opportunities to the page?

2.  where is the doc that this code snippet comes from?

 

thanks

 

Ron HessRon Hess
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_edit_data.htm