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
alockremalockrem 

Need help updating a list via a data table

I have come across this issue a number of times in the past few months and always found work-arounds.  I have never gotten this to work, which is obvously because I'm missing something.

 

I have a custom object called cpeRateElements.  I have a data table displaying the values in the list and a few of them should be editable.  The changes I make get ignored.  How do I pass values from data table form fields back to the custom object?

 

 

<apex:dataTable value="{!cpeRateElements}" var="cre" cellpadding="4" border="1">
<apex:column headerClass="tableHeader" headerValue="Qty">
<apex:selectList value="{!cre.quantity}" size="1">
<apex:selectOptions value="{!quantityOptions}" />
<apex:actionSupport event="onChange" rerender="reSummary" />
</apex:selectList>
</apex:column>
<apex:column headerClass="tableHeader" headerValue="Vendor" value="{!cre.vendor}" />
<apex:column headerClass="tableHeader" headerValue="Vendor Number" value="{!cre.vendorNumber}" />
<apex:column headerClass="tableHeader" headerValue="Part Number" value="{!cre.partNumber}" />
<apex:column headerClass="tableHeader" headerValue="MAT Code" value="{!cre.matCode}" />
<apex:column headerClass="tableHeader" headerValue="Cost" value="{!cre.cost}" />
<apex:column headerClass="tableHeader" headerValue="GL Type" value="{!cre.glType}" />
<apex:column headerClass="tableHeader" headerValue="Labor Units">
<apex:inputText value="{!cre.laborUnits}" style="width: 40px;"/>
</apex:column>
<apex:column headerClass="tableHeader" headerValue="Labor Rate" value="{!cre.laborRate}" />
<apex:column headerClass="tableHeader" headerValue="Maint Code" value="{!cre.maintenanceCode}" />
<apex:column headerClass="tableHeader" headerValue="Maint %" value="{!cre.maintenancePercentage}" />
<apex:column headerClass="tableHeader" headerValue="GM %">
<apex:inputText value="{!cre.gmPercentage}" style="width: 40px;"/>
</apex:column>
</apex:dataTable>

 

FYI - reSummary is an exact replica of this table that just displays the values from cpeRateElements on the screen without the form fields.  That is one of my attempts to see the updates happening.  Needless to say, when I update the quantity field in this table nothing happens in reSummary.

 

Any help is greatly appreciated.