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() {
        try {
            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. Feb 5 '19 at 10:41
  • Can you please provide me some samples? It would be helpful
    – SKH
    Feb 5 '19 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 '19 at 14:59
  • @SKH Yes, that should work. What's the problem you're experiencing?
    – sfdcfox
    Feb 5 '19 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 '19 at 15:16

Based on the code you provided in your post, can you confirm if you are planning for inline edit on Custom Metadata Type records or Custom object record?

Here is an example code from Salesforce developer guide that shows inline editing. Can you try like below?


<apex:page standardController="Account" recordSetVar="records" id="thePage"> 
    <apex:form id="theForm"> 
        <apex:pageBlock id="thePageBlock"> 
            <apex:pageBlockTable value="{!records}" var="record" id="thePageBlockTable"> 
                <apex:column >
                    <apex:outputField value="{!record.Name}" id="AccountNameDOM" /> 
                    <apex:facet name="header">Name</apex:facet>
                <apex:column >
                    <apex:outputField value="{!record.Type}" id="AccountTypeDOM" /> 
                    <apex:facet name="header">Type</apex:facet>
                <apex:column >
                    <apex:outputField value="{!record.Industry}" 
                        id="AccountIndustryDOM" />  
                        <apex:facet name="header">Industry</apex:facet>
                <apex:inlineEditSupport event="ondblClick" 
                        showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" /> 
            <apex:pageBlockButtons > 
                <apex:commandButton value="Edit" action="{!save}" id="editButton" />
                <apex:commandButton value="Save" action="{!save}" id="saveButton" />
                <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />

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.