Salesforce 无法传递参数<;顶点:参数>;根据相关方法
假设我有一个页面代码:Salesforce 无法传递参数<;顶点:参数>;根据相关方法,salesforce,apex-code,visualforce,Salesforce,Apex Code,Visualforce,假设我有一个页面代码: <apex:pageBlockTable value="{!allContacts}" var="c" > <apex:column value="{!c.id}" headervalue="ID"/> <apex:column value="{!c.FirstName}" headervalue="First Name"/> <apex:col
<apex:pageBlockTable value="{!allContacts}" var="c" >
<apex:column value="{!c.id}" headervalue="ID"/>
<apex:column value="{!c.FirstName}" headervalue="First Name"/>
<apex:column value="{!c.LastName}" headervalue="Last Name"/>
<apex:column value="{!c.Title}" headervalue="Title"/>
<apex:column value="{!c.Company}" headervalue="Company"/>
<apex:column>
<apex:commandButton action="{!addToRecruits}" value="Recruit">
<apex:param assignTo="{!leadID}" name="leadID" value="{!c.id}"/>
</apex:commandButton>
</apex:column>
</apex:pageBlockTable>
看起来像臭名昭著的平台bug?其中apex:param值并不总是通过apex:commandButton发送到控制器(尽管它们是通过apex:commandLink发送的) Jeff Douglas在此总结了该问题的简单概述和可能的解决方法:将“rerender”属性添加到apex:commandButton,它将开始工作-类似于
有一种方法可以将参数传递给控制器,但它也将使用commandLink。我的意思是我们需要使用
- 命令链接和命令按钮
对于未来与Salesforce相关的问题,如果您在Stack Exchange Salesforce的专用站点上发表文章,您可能会得到更多的关注。。。从现在开始,我将这样做……我看到你已经这样做了——为了将来的参考,这里讨论了相同的问题:
public String leadID { get; set; }
public PageReference addToRecruits() {
System.debug('LeadID is: ' + leadID);
List<Lead> potentialCandidate = [SELECT id, FirstName, lastName, Title, Company FROM Lead WHERE id = :leadID];
delete potentialCandidate;
return null;
}
public String leadID { get; set; }
public PageReference addToRecruits() {
Lead candidate=new Lead(id=leadID);
....
}
<apex:commandLink action="{!applyNow}" id="applybuttonLink" style="text-decoration:none">
<apex:commandButton value="Apply now"/>
<apex:param name="passId" assignTo="{!passId}" value="{!Vac.id}"/>
</apex:commandLink>
public String vacancyId{get;set;}