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
Pritam Patil 19Pritam Patil 19 

Enable InlineEdit for apex:outputtext

Hello,

      I have a VisualForce page in which I am showing the data in table using apex:outputtext inside apex:column. How do I enable InlineEdit for it
     
      Following is a sample code:
      <apex:column headerValue="Participant Name">  
           <apex:outputText value="{!c.Participant_Name__c}"/>    
      </apex:column>

Thanks.
IshwarIshwar
I believe you can not implement inLine editing for outpuText fields. 
The <apex:inlineEditSupport> component must be a descendant of the following components:
<apex:dataList>
<apex:dataTable>
<apex:form>
<apex:outputField>
<apex:pageBlock>
<apex:pageBlockSection>
<apex:pageBlockTable>
<apex:repeat>
Refer below link for more details:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_inline_editing.htm

Thanks
 
Rupal KumarRupal Kumar
Hi Pritam,
This is page-
<apex:page controller="DataTableEditRemoveControllerEdt">
<apex:form id="form" >
<apex:pageBlock title="Accounts">
  <apex:pageMessages ></apex:pageMessages>
  <apex:pageBlockTable value="{!accs}" var="row">
     <apex:column >
       <apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
       <a href="javascript:if (window.confirm('Are you sure?')) DeleteAccount('{!row.Id}');" style="font-weight:bold">Del</a>
     </apex:column>
     <apex:column value="{!row.Name}"/>
     <apex:column value="{!row.BillingStreet}"/>
     <apex:column value="{!row.BillingCity}"/>
     <apex:column value="{!row.BillingPostalCode}"/>
     <apex:column value="{!row.BillingCountry}"/>
  </apex:pageBlockTable>
</apex:pageBlock>

<apex:actionFunction action="{!DeleteAccount}" name="DeleteAccount" reRender="form" >
   <apex:param name="accountid" value="" assignTo="{!SelectedAccountId}"/>
</apex:actionFunction>
</apex:form>
</apex:page>

Controller-
public class DataTableEditRemoveControllerEdt {

   public List<Account> accs { get; set; }
  
   //used to get a hold of the account record selected for deletion
   public string SelectedAccountId { get; set; }
  
   public DataTableEditRemoveControllerEdt() {
       //load account data into our DataTable
       LoadData();
   }
  
   private void LoadData() {
       accs = [Select id, name, BillingStreet, BillingCity, BillingPostalCode, BillingCountry from Account limit 20];
   }
  
   public void DeleteAccount()
   {
      // if for any reason we are missing the reference 
      if (SelectedAccountId == null) {
      
         return;
      }
     
      // find the account record within the collection
      Account tobeDeleted = null;
      for(Account a : accs)
       if (a.Id == SelectedAccountId) {
          tobeDeleted = a;
          break;
       }
      
      //if account record found delete it
      if (tobeDeleted != null) {
       Delete tobeDeleted;
      }
     
      //refresh the data
      LoadData();
   }    
  
  
}
Thanks
Rupal Kumar
http://Mirketa.com
 
Pritam Patil 19Pritam Patil 19
Thank you Ishwar and Rupal. Appreciate it.
RatanRatan
Since you are using sobject field Participant_Name__c then use apex:outputField with inline edit support like below code
 
<apex:column headerValue="Participant Name">  
    <apex:outputField value="{!c.Participant_Name__c}">
		<apex:inlineEditSupport event="ondblClick" />
	</apex:outputField>
</apex:column>