我有一个控制器,其变量作为数组输出 - 我想使用UPDATE让我的用户能够对显示VF页面的记录进行内联编辑。这是可能吗?
这是我的控制器:
public with sharing class QualOpController
{
public List <Opportunity> Opty {get;set;}
public list<String> campaigns {get;set;}
public PageReference saveOp(){
UPDATE Opty;
return null;
}
public String getName(){
return 'QualOpController';
}
public void load()
{
campaigns= new List<String>();
Opty = [Select id, name, CreatedDate, StageName, Vert_Med__c, Company_Name__c, Next_Step__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c from Opportunity WHERE Pipeline_Oppty__c = TRUE ];
Set<String> campaignSet = new Set<String>();
for (Opportunity j : Opty)
campaignSet.add(j.Vert_Med__c);
for (String campaign : campaignSet)
{
campaigns.add(campaign);
}
campaigns.sort();
}
}
我想得到:
public PageReference saveOp(){
UPDATE Opty;
return null;
}
public String getName(){
return 'QualOpController';
}
更新由以下人员查询的记录:
campaigns= new List<String>();
Opty = [Select id, name, CreatedDate, StageName, Vert_Med__c, Company_Name__c, Next_Step__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c from Opportunity WHERE Pipeline_Oppty__c = TRUE ];
但这些变化只是拯救了。
有什么我可以做的不同来使这项工作?
谢谢,
约翰
编辑以下是我的网页代码:
<apex:page controller="QualOpController" action="{!load}" showHeader="false">
<apex:stylesheet value="{!URLFOR($Resource.SortableTable, 'sortableTable.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.SortableTable, 'sortableTable.js')}"/>
<html>
<head>
<meta charset="utf-8" />
<title>R2M PIPELINE</title>
<link rel="stylesheet" type="text/css" href="{!URLFOR($Resource.GUIstyle)}" media="all" />
</head>
<body>
<div id="header">
<div id="logo">
<a href="index.html"><img src="{!URLFOR($Resource.Logo)}" alt="" /></a>
</div>
<ul>
<li><a href="apex/GUIHome"><span>Gene</span></a></li>
<li><a href="/apex/HappeningNow"><span>Happening Now</span></a></li>
<li><a href="/apex/ClientDelivery"><span>Client Delivery</span></a></li>
<li><a href="/apex/MediaCash"><span>Media Cash</span></a></li>
<li><a href="/apex/ROIREVENUE"><span>ROI and Revenue</span></a></li>
<li><a href="/apex/PRODUCTION"><span>Production</span></a></li>
<li><a href="/apex/SalesActivity"><span>Sales Activity</span></a></li>
<li><a href="/apex/PIPerformance"><span>PI Performance</span></a></li>
<li><a href="https://na2.salesforce.com/"><span>Salesforce Home</span></a></li>
</ul>
</div>
<div id="body">
<div class="about">
<h1>R2M Pipeline</h1>
<div>
<c:PipelineNav />
<apex:repeat value="{!campaigns}" var="camp">
<apex:form >
<apex:pageBlock title="{!camp}" mode="inlineedit">
<table cellpadding="5" style="border-collapse: collapse;table-layout:fixed" width="1080" border="1" class="list sortable" >
<tr class="headerRow">
<th style="background-color: #C6D4D4; color: #040404" width="100">
<b>Opportunity Name</b>
</th>
<th style="background-color: #C6D4D4; color: #040404" width="100">
<b>Company Name</b>
</th>
<th style="background-color: #C6D4D4; color: #040404" width="80">
<b>Contract Sent</b>
</th>
<th style="background-color: #C6D4D4; color: #040404" width="50">
<b>Days Idle</b>
</th>
<th style="background-color: #C6D4D4; color: #040404" width="70">
<b>Created</b>
</th>
<th style="background-color: #C6D4D4; color: #040404" width="450">
<b>Next Step</b>
</th>
<th style="background-color: #C6D4D4; color: #040404" width="50">
<b><apex:commandLink reRender="button" onclick="window.open('/apex/Probability_Guide','','width=500,height=300')" id="button">Prob%</apex:commandLink></b>
</th>
<th style="background-color: #C6D4D4; color: #040404" width="100">
<b>Owner</b>
</th>
<th style="background-color: #C6D4D4; color: #040404" width="100">
<b>Stage</b>
</th>
</tr>
<apex:repeat value="{!listOfOpty}" var="cs">
<apex:outputPanel layout="none" rendered="{!IF(camp=cs.Vert_Med__c,true,false)}" >
<tr class="dataRow even first" style="">
<td width="100">
<a href="https://na2.salesforce.com/{!cs.id}">{!cs.name}</a>
</td>
<td width="100">
{!cs.Company_Name__c}
</td>
<td width="80">
<apex:outputField value="{!cs.Contract_SENT__c}" >
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton" />
</apex:outputField>
</td>
<td width="50">
{!cs.Days_Since_Last_Modified__c}
</td>
<td width="70">
{!MONTH(DATEVALUE(cs.CreatedDate))}/{!DAY(DATEVALUE(cs.CreatedDate))}/{!YEAR(DATEVALUE(cs.CreatedDate))}
</td>
<td width="450">
<apex:outputField value="{!cs.Next_Step__c}" >
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton" />
</apex:outputField>
</td>
<td width="50">
<apex:outputField value="{!cs.Probability}" >
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton" />
</apex:outputField>
</td>
<td width="100">
{!cs.Owner_Name__c}
</td>
<td width="100">
{!cs.StageName}
</td>
</tr>
</apex:outputPanel>
</apex:repeat>
</table>
<apex:commandButton action="{!saveOp}" value="Update Opptys"/>
</apex:pageBlock>
</apex:form>
<br/>
</apex:repeat>
</div>
<div>
</div>
<div> </div>
</div>
</div>
<div id="footer">
<div>
<div>
<h3></h3>
<ul>
<li></li>
<li></li>
</ul>
</div>
<div>
<h3></h3>
<ul>
<li></li>
<li></li>
</ul>
</div>
<div>
<h3></h3>
<ul>
<li></li>
<li></li>
</ul>
</div>
<div>
<h3></h3>
<ul>
<li></li>
<li></li>
</ul>
</div>
<div>
<h3>Social</h3>
<a class="facebook" href="https://www.facebook.com/pages/Ring2Media-INC/845391462194555" target="_blank">R2M Facebook</a>
<a class="twitter" href="https://twitter.com/ring2media" target="_blank">R2M Twitter</a>
</div>
</div>
<div>
</div>
</div>
</body>
</html>
</apex:page>
答案 0 :(得分:0)
首先,我建议在 salesforce.stackexchange.com 上询问有关salesforce的问题 - 您将更快地获得答案。 其次 - 你的Opty List应该完美更新。我建议你这样写:
public PageReference saveOp(){
System.debug(Opty);
UPDATE Opty;
return null;
}
按下&#34; saveOp()&#34;按钮检查日志 - 集合中的元素是否更改。最有可能的问题不在于更新,因为它不会给您一个错误。如果您发布您的VF页面代码也会有所帮助。