You need to sign in to do that
Don't have an account?

Can't update a line in PageBlockTable
Hi, I make a pageBlockTable of ForecastingQuota, but when I save it, nothing happen, my QuotaAmount want to be saved.
VFP Code :
Apex :
VFP Code :
<apex:pageMessages /> <apex:pageBlock title="All ForecastingQuotas" id="forecast_list" mode="inlineEdit" > <apex:PageBlockButtons > <apex:commandButton action="{!save1}" value="save"/> </apex:PageBlockButtons> <apex:pageBlockTable value="{!loadquotas}" var="qs" id="aforecastlist"> <apex:column headerValue="Id"> <apex:outputField value="{!qs.Id}"/> </apex:column> <apex:column headerValue="QuotaAmount"> <apex:outputField value="{!qs.QuotaAmount }"/> </apex:column> <apex:column headerValue="QuotaOwnerId"> <apex:outputField value="{!qs.QuotaOwnerId}"/> </apex:column> <apex:column headerValue="StartDate"> <apex:outputField value="{!qs.StartDate}"/> </apex:column> <apex:column headerValue="ForecastingTypeId"> <apex:outputField value="{!qs.ForecastingTypeId}"/> </apex:column> <apex:column headerValue="IsAmount"> <apex:outputField value="{!qs.IsAmount}"/> </apex:column> <apex:column headerValue="ProductFamily"> <apex:outputField value="{!qs.ProductFamily}"/> </apex:column> <apex:column headerValue="QuotaQuantity"> <apex:outputField value="{!qs.QuotaQuantity}"/> </apex:column> <apex:column headerValue="PeriodId"> <apex:outputField value="{!qs.PeriodId}"/> </apex:column> <!-- <apex:inlineEditSupport event="ondblClick"/> --> </apex:pageBlockTable> </apex:pageBlock>
Apex :
public List<ForecastingQuota> getLoadQuotas() { List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>(); resultsquotas = [SELECT Id,CurrencyIsoCode, ForecastingTypeId, IsAmount, IsQuantity, PeriodId,ProductFamily,QuotaAmount,StartDate,QuotaQuantity,QuotaOwnerId FROM ForecastingQuota ORDER BY QuotaAmount DESC]; return resultsquotas; } public void save1() { List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>(); resultsquotas = [SELECT Id,CurrencyIsoCode, ForecastingTypeId, IsAmount, IsQuantity, PeriodId,ProductFamily,QuotaAmount,StartDate,QuotaQuantity,QuotaOwnerId FROM ForecastingQuota]; update resultsquotas; System.debug(resultsquotas); }Thanks for your help
You can't actually update data using page block table.It is used to display data in a tabuler fashion.
And clearly we use apex:outputField for displaying values(QuotaAmount) in page block table.To save input values we have to use apex:inputField.
Mark it as solved if it helps.
Thanks.
It would be better to modify existing one like this.
Try this page. for more info:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_iteration_components_editing.htm
Let me know if you have any issues.
Mark it as best answer if it works.
Thanks.
Are you able to edit the field now?
Please share controller
Thanks.
Thanks
Mark it as best answer if it works.
Thanks.