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 

How to Save/Update PageBlockTable records using inlineEditSupport and custom save button

Hi,

I am using inlineEditSupport for my PageBlockTable that renders a list, when I try to use standard save '{!Save}' it just refreshes the page with the same values. I have tried using Apex:actionFunction to pass the parameters to the class, but when I pass parameters to the JS the changed value of the field does not pass to the JS rather the original value is passed, so even if it updates it updates the same value.

How do I save the record?

Following is my code :
VISUALFORCE :
<apex:pageBlockTable value="{!RecentFleetListNew}" var="fleet" id="FleetTable">
        <apex:column headerValue="ID" style="cursor:pointer;">
            <apex:outputField value="{!fleet.Id}" ></apex:outputField>
        </apex:column>
        <apex:column headerValue="Load" style="cursor:pointer;">
            <apex:outputField value="{!fleet.Load_Classification__c}" ></apex:outputField>
        </apex:column>
         <apex:column >
        <apex:commandButton value="Save" id="SaveButton" onclick="GetAndPass('{!fleet.Id}','{!fleet.Load_Classification__c}')"/>       
        </apex:column>
 <apex:inlineEditSupport event="ondblclick" showOnEdit="SaveButton" />
</apex:pageBlockTable>

<apex:actionFunction name="passFleet" action="{!fleetUpdate}" reRender="FleetTable">
    <apex:param name="fId" value="" id="fleetParaOne"/>
    <apex:param name="fLclass" value="" id="fleetParaFour"/>            
 </apex:actionFunction>          

JAVASCRIPT :
    function GetAndPass(fid,fLclass){
    alert('In Function------>'+fid+'And this----->'+fLclass);
    passFleet(fid,fLclass);
    }

APEX CLASS :
public void fleetUpdate(){
        fleetId = Apexpages.currentPage().getParameters().get('fId');
        LoadPicklist = Apexpages.currentPage().getParameters().get('fLclass');
        
        Customer_Fleet__c CF = new Customer_Fleet__c();
        CF.Id = fleetId;
        CF.Load_Classification__c = LoadPicklist;
     update CF;
    }

The values appearing in the JS alert are the same as the values displayed in the table even though the JS is being called after the value is changed using inlineEdit.

Please HELP !

Thanks,
Pritam. 
HARSHIL U PARIKHHARSHIL U PARIKH
Here are the three things I can think of,
1) You probably have look already but double check the object permissions, validations, profile settings  etc..
2) You can add the apex tag to your page then it might show you what the error is.
Add the tag like below,
<apex:page standardController="Case" >
<apex:pageMessages/>
<apex:form >
3) try adding mode="edit" on pageBlock
If you have <apex:pageBlock> section before <apex:pageBlockTable> then add mode to the pageBlock as
<apex:pageBlock mode="edit">

and you can use: <apex:commandButton value="Save" action="{!save}"/> for saving record.