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
Saniya Khan 2Saniya Khan 2 

how to use inlineEditSupport with custom object

Hi,
I am new to the salesforce. Wanted to use inline edit with custom object recode but got stuck anybody please fhelp me.
Here is my code

Visual Force page
<apex:page controller="projectDisplay" >
    <apex:form >
    <apex:pageBlock >
     <apex:pageBlockButtons >
                 <apex:commandButton value="Save" action="{!SaveProject}"/>
             </apex:pageBlockButtons>
                 
            
        <apex:pageBlockSection title="Enter Project Details" collapsible="false" columns="1">
        
              <apex:inputField value="{!proj.name}"/>
              <apex:inputField value="{!proj.Status__c}"/>
              <apex:inputField value="{!proj.Start_Date__c}"/>
              <apex:inputField value="{!proj.ExpectedEndDate__c}"/>
              <apex:inputField value="{!proj.ActualEndDate__c}"/>
                   
        </apex:pageBlockSection>
        </apex:pageBlock>
            </apex:form>
  <apex:form >  
<apex:pageBlock mode="inlineEdit" >
    <apex:pageBlockSection title="Project Details" >
        
        <apex:pageBlockTable value="{!project}" var="p" align="center">
            <apex:column >
             <apex:commandLink action="{!deleteProject}" value="Del" >
                        <apex:param value="{!p.id}" name="column" assignTo="{!selectedLineDel}" ></apex:param>
                    </apex:commandLink>
            </apex:column>
            <apex:column >
             <apex:commandLink action="{!updateProject}" value="Edit" >
                        <apex:param value="{!p.id}" name="column" assignTo="{!selectedLineEdit}" ></apex:param>
                    </apex:commandLink>
            </apex:column>

               <apex:column value="{!p.name}"/>
             <apex:column value="{!p.Status__c}"/>
            <apex:column value="{!p.Start_Date__c}"/>
            <apex:column value="{!p.ExpectedEndDate__c}"/>
            <apex:column value="{!p.ActualEndDate__c}"/>
            
            </apex:pageBlockTable>        
       <!--  <apex:inlineEditSupport />
           <apex:commandButton value="Save All " action="{!QuickSave}"/>-->
        
        </apex:pageBlockSection>
    
    </apex:pageBlock>
    </apex:form>
</apex:page>

Apex Code

public class projectDisplay {
    
public project__c proj { get; set; }
public project__c project { get; set; }
 public List<Project__c> p ;
public String selectedLineDel{get;set;}  
public String selectedLineEdit{get;set;}
public String name{get;set;}
    
    public List<Project__c> getproject()
    {
        
        p=[select Name,ExpectedEndDate__c,ActualEndDate__c,Start_Date__c,Status__c from Project__c];
        return p;
    }
    
    //inline Delete
    public pageReference deleteProject()
    {
        Project__c pd=[select id from Project__c where id=:selectedLineDel];
        delete pd;
        return null;
    }
    //inline Update
    public pageReference updateProject()
    {
      List<project__c> edit=new List<Project__c>();
        List<Project__c> pedit=[select Name,ExpectedEndDate__c,ActualEndDate__c,Start_Date__c,Status__c from Project__c where id=:selectedLineedit];
       for(Project__c pe:pedit)
        {
           pe.Name=project.Name;
            pe.ActualEndDate__c=project.ActualEndDate__c;
            pe.ExpectedEndDate__c=project.ExpectedEndDate__c;
            pe.Start_Date__c=project.Start_Date__c;
            pe.Status__c=project.Status__c;
            edit.add(pe);
        }
        update edit;
        return null;
    }
    
    //constructor
    public projectDisplay(){
        proj=new Project__c();
    }
    
    //insert Project Record
    public pageReference saveProject()
    {
        
        insert proj;
        return null;
    }
        
}
 
Vinod ChoudharyVinod Choudhary
Hi Saniya,

This can help you.

http://burnignorance.com/salesforce-tips/how-to-use-inline-edit-in-a-custom-visualforce-ui-page/   

http://salesforceworld.blogspot.in/2011/06/inline-editing-in-visualforce-page.html  


Thanks
Vinod