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
Jim BoudreauxJim Boudreaux 

Bulk Upload with Inlineeditsupport and a pageblocktable

If I have a Custom Controller and VisualForce page with a PageBlockTable and InlineEditSupport, what do I need to do to save the changes to multiple records in my PageBlockTable?

 

I tried 

public PageReference SaveTiers(){
        update tiers;
        setup(fields.id);
        return null;
    }

 where tiers is a list<tier__c> and setup() grabs the list of tier__c and fills tiers. THe thing is, I got this working at one point, but after a refresh it quit working and now I can't get it to work at all.

 

I would post all my code, but it would just confuse more because it is complicated and calls a lot of outside classes. Suffice to say, all I want to know is how would I write a function that saves the changes to a list of records that were changed via the inlineediting ui in a pageblocktable?

 

Jim BoudreauxJim Boudreaux

Ok, When I change that function to a void as opposed to a PageReference and delete the rerender attribute of the button that calls it, the inline editing saves like you would expect, BUT, only the last record works. If I edit any other records besides the last one and save none of those changes are save.

tartanarmytartanarmy

I am experiencing the same issue.

 

I have a pageBlockTable which displays a list of dataComponents - a List<Solution_Component__c>;

 

 

<apex:form >
<apex:pageBlock >
<apex:facet name="header">
                <table cellspacing="0" cellpadding="0" border="0" width ="100%">
                <tr><td class="pbTitle">
                <h2 class ="mainTitle">Deliverable Components</h2>
                </td></tr></table>
</apex:facet>
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlockTable value="{!dataComponents}" var="e" rendered="{!NOT(ISNULL(dataComponents))}">
<apex:column >
<apex:commandlink action="https://emea.salesforce.com/{!e}" value="{!e.Name}">
</apex:commandLink>
</apex:column>
<apex:column value="{!e.Description__c}"></apex:column>
<apex:column value="{!e.Setup_Effort__c}"></apex:column>
<apex:column value="{!e.Type__c}"></apex:column>
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton"/>
</apex:pageBlockTable>
<apex:pageBlockButtons >
                <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
                <apex:commandButton action="{!cancel}" id="cancelButton" value="Cancel"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>

 

 

and in my apex class my save method is as follow;

 

 

  public void save() {
  		for (Solution_Component__c i: dataComponents) {
  			update i;
  		}
  }

 

 

This will save the last edited row in the pageBlockTable but nothing above it and not sure why?

 

 

 

 

 

 

 

 

 

 

KVaishnaKVaishna

I am also facing the same issue. Page does not save any other records except last one. Did you find any solution? Please let me know.

 

Thanks

wgouldingwgoulding

I faced this issue and the solution was to use the inlineEditSupport tag on an inputField level, rather than a column level.

 

Try doing something like this:

 

<apex:pageBlockTable value="{!dataComponents}" var="e" rendered="{!NOT(ISNULL(dataComponents))}">
<apex:column >
<apex:commandlink action="https://emea.salesforce.com/{!e}" value="{!e.Name}"></apex:commandLink>
</apex:column>
<apex:column >
<apex:outputField value="{!e.Description__c}">
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton"/>
</apex:outputField>
</apex:column> <apex:column >
<apex:outputField value="{!e.Setup_Effort__c}">
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton"/>
</apex:outputField>
</apex:column>
<apex:column >
<apex:outputField value="{!e.Type__c}">
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton"/>
</apex:outputField>
</apex:column>
</apex:pageBlockTable>
jjulianjjulian

@wgoulding, that did not fix the problem for me. Can you confirm this?

 

EDIT: Actually scratch that. It works.