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
lovecrmlovecrm 

Data not displaying in the related list of VF page

Hi,

 

 I am having a VF page QuickCreate. There is a table in a section from where on button click the default data from custom settings will be displayed in the table.

 

The user can also change the data in the table of VF page. Here when iam trying to save the changed data is not displaying but only the default data is being displayed.

 

I had written get;set methods too.

 

VF page

 

 

<apex:repeat value="{!prop_ser}" var="ps" id="repeatBlock">

<tr class="headerRow">
   <th scope="col" class="" bgcolor="grey">Type</th>
   <th scope="col" class="" bgcolor="grey">Quantity</th>
   <th scope="col" class="" bgcolor="grey">Category</th>
   <th scope="col" class="" bgcolor="grey">Description</th>
   <th scope="col" class="" bgcolor="grey">Estimated Value</th>
   <th scope="col" class="" bgcolor="grey">Frequency</th>
</tr>
<tr class="first last even dataRow">
   <td class="dataCell"><apex:inputField value="{!ps.PropServiceRecord.Type__c}" id="proptype" onchange="javascript&colon;totalamtdisplay()"/></td>
           <td class="dataCell"><apex:inputField value="{!ps.PropServiceRecord.Quantity__c}" style="width:40px;"/></td>
            <td class="dataCell"><apex:inputField value="{!ps.PropServiceRecord.Material_Category__c}"/></td>
             <td class="dataCell"><apex:inputField value="{!ps.PropServiceRecord.Material_Description__c}"/></td>
              <td class="dataCell"><apex:inputField value="{!ps.PropServiceRecord.Estimated_Value__c}" id="estamt" style="width:40px;" 
                                           onblur="javascript&colon;totalamtdisplay()"/></td>
                <td class="dataCell"><apex:inputField value="{!ps.PropServiceRecord.Frequency__c}"/></td>
           </tr>
</apex:repeat>

 

 

Controller class

 

 

public mycontroller()
{

public List<QuickCreate.ProposedService> getprop_ser()
{
  if(IsQuickAddButton == true)
            {  
            	system.debug('Entered Quick Add code'+IsQuickAddButton);
                //Quick_Add_Products__c prop_services=Quick_Add_Products__c.getInstance('cmlinkParam');                                      
                prop_services =([select id,Type__c,Quantity__c,Frequency__c,Occurs__c,On_Call__c,Material_Category__c,Material_Description__c,Service__c from 
                                               Quick_Add_Products__c where Name=:cmlinkParam]);
                prod=([select id,Description,Material__c  from Product2 where id=:prop_services.Service__c]);
                propser = new Proposed_Services__c();
                propser.Service__c = prop_services.Service__c;
                propser.Type__c = prop_services.Type__c;
                propser.Quantity__c = prop_services.Quantity__c;
                propser.Frequency__c = prop_services.Frequency__c;
                propser.Occurs__c = prop_services.Occurs__c;
                propser.On_Call__c = prop_services.On_Call__c;
                propser.Material_Category__c = prop_services.Material_Category__c;
                propser.Material_Description__c = prop_services.Material_Description__c;
                system.debug('CHanged Data');
                
                QuickCreate.ProposedService ps = new ProposedService(propser, prod[0].Description, prod[0].Material__c);
                prop_ser.add(ps);
                system.debug('Quick Button'+prop_ser);
                System.debug('Size.....................' + prop_ser.size());
                IsQuickAddButton = false;
            }
           return prop_ser;
}
public class ProposedService
    {
        public Proposed_Services__c PropServiceRecord {public get; private set;}
        public String ServiceDesc {public get; private set;}
        public String ServiceMat{public get; private set;}
        public string ServiceType{public get;private set;}
        
        public ProposedService (Proposed_Services__c ps, String servDesc, String servMat)
        {
        	system.debug('Proposed Services Class:'+ps);
            PropServiceRecord = new Proposed_Services__c();
            PropServiceRecord = ps;
            ServiceDesc = servDesc;
            ServiceMat = servMat;
            //ServiceType=servType;
        }
    }
}

 

 

Here is my setter method:

 

public void setprop_ser(List<QuickCreate.ProposedService> ser)
    {
        prop_ser = ser;
        system.debug('PROP SER'+prop_ser);
    }

 

Can anyone help me sort out where iam making mistake.

 

I am not able to display the changed data when i click save.

bob_buzzardbob_buzzard

You can't update a list via a setter.  As you have backed the various input fields with data from the list, once the button is clicked, the underlying variables in the list will be changed.  Thus in order to save back to the database, you will need to iterate the list and update/insert each object.