I am passing a list to the pageblock table and my table looks like below enter image description here

i want to edit the table values. I tried the below code. This is my VF Page code

 <apex:pageBlockSection id="section2" columns="2" collapsible="true" title="Configure Complexity">
        <apex:pageBlockTable style="margin-left: 80%;width:30%" value="{!LMComplexity}" var="com">
         <apex:inlineEditSupport showOnEdit="update, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"></apex:inlineEditSupport>
       <apex:column headerValue="Class" value="{!com.Class__c}" />
       <apex:column headerValue="Maximum Days" value="{!com.Maximum_Complexity_Score__c}"/>
        <apex:column headerValue="Minimum Days" value="{!com.Minimum_Complexity_Score__c}"/>

   <apex:commandButton id="update" action="{!quickUpdat}"/>

and my controller code looks like this

 public class profileList {
        public profileList(ApexPages.StandardController controller) {
    public List <LM_Default_Weightage__mdt> result{get;set;}
    Boolean testval = false;

        public profileList(){
             result= Database.query('Select Class__c, Maximum_Complexity_Score__c,Minimum_Complexity_Score__c From LM_Default_Complexity__mdt');
     public PageReference quickUpdat(){
           return ApexPages.CurrentPage();
        }catch(Exception e){
        return null;
     public list<LM_Default_Complexity__mdt> getLMComplexity()
           List<LM_Default_Complexity__mdt> comp=  [Select Class__c, Maximum_Complexity_Score__c,Minimum_Complexity_Score__c From LM_Default_Complexity__mdt];
           return comp;

So basically i am querying my custom metadata put it in a list and returned it.Finally displaying the returned list in pageblock table. Is the table editable?

Note: I tried directly passing the custom metadata and i cannot edit the table.Custom metadata isn't editable

  • Using wrapper class and add checkbox for all rows you can edit it inline. – cloudZigZag Feb 5 at 10:41
  • Can you please provide me some samples? It would be helpful – SKH Feb 5 at 12:26

Use an apex:inputField inside the column.

<apex:column headerValue="Maximum Days">
 <apex:inputField value="{!com.Maximum_Complexity_Score__c}"/>
<apex:column headerValue="Minimum Days">
 <apex:inputField value="{!com.Minimum_Complexity_Score__c}"/>
  • It didn't work either.I am passing a list to this pageblock table – SKH Feb 5 at 14:59
  • @SKH Yes, that should work. What's the problem you're experiencing? – sfdcfox Feb 5 at 15:08
  • When i double click on the table row it is not in edit mode. I cannot edit any vaues in the table – SKH Feb 5 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.