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
regurireguri 

StandardSet controller not saving the record

Hi All,

The below standardset controller code  is not saving the record changes.
Please help me to find where I am going wrong.

<apex:page controller="iolineController" >
<apex:form >
     <apex:pageBlock mode="inlineEdit" id="pb">
        <apex:pageBlockTable value="{!iolines}" var="line">
         <apex:column value="{!line.id}"/>
            <apex:column headerValue="Name">
              <apex:outputField value="{!line.Name}" />
            </apex:column>  
         </apex:pageBlockTable>
      </apex:pageBlock>
<apex:commandButton value="Save" action="{!setCon.save}" title="Refresh Page"/>
</apex:form>        
</apex:page>

public class iolineController {

    public List<io_Line__c> getIolines() {
        return (List<io_Line__c>) setCon.getRecords();
    }
     public string channelIOId;
   
  public ApexPages.StandardSetController setCon {
        get {
            channelIOId= ApexPages.CurrentPage().getParameters().get('chId');
            if(setCon == null) {
                   setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                   [Select i.Name, i.Id  From IO_Line__c i where i.Channel_IO__c=:channelIOId ]));
                 
            }
            return setCon;
        }
        set;
    }
   

}
regurireguri
Tried with this code, still not saving the record.

<apex:page standardcontroller="IO_Line__c" recordSetVar="iolines" extensions="iolineController" >
<apex:form >
     <apex:pageBlock mode="inlineEdit" id="pb">
        <apex:pageBlockTable value="{!iolines}" var="line">
         <apex:column value="{!line.id}"/>
            <apex:column headerValue="Name">
              <apex:outputField value="{!line.Name}" />
            </apex:column>  
         </apex:pageBlockTable>
      </apex:pageBlock>
<apex:commandButton value="Save" action="{!save}" />
</apex:form>        
</apex:page>


--------------------------------------------------------------------------
public class iolineController {

    ApexPages.StandardSetController controller;
    public iolineController(ApexPages.StandardSetController controller) {
     channelIOId= ApexPages.CurrentPage().getParameters().get('chId');
        this.controller = new ApexPages.StandardSetController(Database.getQueryLocator(
                   [Select i.Name, i.Id  From IO_Line__c i where i.Channel_IO__c=:channelIOId  ]));
       
        }

    public List<io_Line__c> getIolines() {
        return (List<io_Line__c>) controller.getRecords();
    }
     public string channelIOId;
    public PageReference save() {
 
        try{
             controller.save();
         }
         catch (Exception e){
           System.debug('e:'+e);
         }  
         return null;    
}
   

}