+ Start a Discussion
JosephJJosephJ 

inline edit in pageblocksection not working

I want to do an inline editing of pageblock for Task object .Scratching my head from hours . Please help me to modify my code .

<!-- VF page -->

<apex:page standardController="Task" extensions="TaskSearchController">
 
     <apex:form id="searchForm">
      <apex:PageBlock mode="edit">     
     
            <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:inlineEditSupport showOnEdit="saveButton, cancelButton"
                     hideOnEdit="editButton" event="ondblclick"
                        changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
            
      <apex:pageblockSection id="searchBlockSection">
       <apex:pageBlockSectionItem id="searchBlockSectionItem">
        <apex:outputLabel >Keyword</apex:outputLabel>
            <apex:panelGroup >
                <apex:inputtext id="searchTextBox" value="{!searchText}">

                </apex:inputtext>
                <apex:commandButton Id="btnSearch" action="{!Search}" rerender="renderBlock" status="status" title="Search" value="Search">                    </apex:commandButton>
            </apex:panelGroup>
        </apex:pageBlockSectionItem>
    </apex:pageblockSection>
    <apex:actionStatus id="status" startText="Searching... please wait..."/>     
    <apex:pageBlocksection id="renderBlock" >
        <apex:pageblocktable value="{!SearchResults}" var="o" rendered="{!NOT(ISNULL(SearchResults))}">
            <apex:outputLink value="/{!o.Id}">{!o.Subject}</apex:outputLink>
            <apex:column value="{!o.Subject}"/>
            <apex:outputLink value="/{!o.Id}">{!o.Status}</apex:outputLink>
            <apex:column value="{!o.Status}"/>
            <apex:outputLink value="/{!o.Id}">{!o.ActivityDate}</apex:outputLink>
            <apex:column value="{!o.ActivityDate}"/>
     </apex:pageblocktable>    
    </apex:pageBlocksection>
   </apex:pageblock>
  </apex:form>

     <apex:enhancedlist type="Activity" height="800" rowsPerPage="50" customizable="False"/>
   </apex:page>


// Apex class


public class TaskSearchController
    {
       public apexpages.standardController controller{get;set;}
       public Task l;
       public List<Task> searchResults {get; set; }

      public string searchText
      {
       get
       {
         if (searchText==null) searchText = '';
         return searchText;
       }
      set;
       }

     public TaskSearchController(ApexPages.StandardController controller)
     {
        this.controller = controller;
        this.l = (Task) controller.getRecord();
      }

    public PageReference search()
    {
      if(SearchResults == null)
      {
        SearchResults = new List<Task>();
      }
     else
     {
        SearchResults.Clear();
     }

String qry ='Select Id,Subject,Status,ActivityDate from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+'%\' Order By Subject,Status,ActivityDate';


    SearchResults = Database.query(qry);
   //System.debug(SearchResults);
   return null;
    }
   }

Really appreciate the help.
Arunkumar RArunkumar R
Did you enabled inline editing in your organization,

Please check it below thing,

Click Setup | Customize | User Interface --> Both the "Enable Inline Editing" and "Enable Enhanced Lists" Should be enabled.


Hope this will solve your problem..!
JosephJJosephJ
 I've already enabled it . But i think there's some mistake with the code area . Please help.Still pressing my head for this .
JosephJJosephJ
Thanks for the quick response. May be you din't get my question . The custom code on task object i've written where it has pageblock in it . On this pageblock , i want an inline edit.

I do not need inline edit when i click on " Subject" field and there by hovering you see it. Which is not the requirement .

Also i tried on all the browsers as well as with my Dev Org but still no luck. (.  I'm stressed ..Can you please show me a screenshot for my better understanding ? Also please if you can come out with solution with my code, it will really help me .Much appreciated.
Dev.AshishDev.Ashish
James,

I believe enabling inline edit is not the problem, but saving the changed value is , right?

Actually you need to use "recordSetVar" on apex:page but for Tasks standard object it is not supported. But for other standard objects they provide it, more @ https://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_list_views.htm.
You might need to try controller only solution with custom "Save" method.



JosephJJosephJ
@ArunKumar ,Very sorry, the requirement from the client was having the same requirement as what you showed.

@Dev , Now this is another problem that i'm facing . It is not working for "recordSetVar" as well for me . When i do changes / update the field name , it is not showing .Any modification with my code that will help me.Thanks
Vasani ParthVasani Parth
Can you please help me to Save the changed value...I'm able to change the value but struggling saving the changed and update it .