我正在为force.com网站开发visualforce页面。我正在使用apex命令链接来执行某些操作。代码如下:
<ul>
<li class="pill-none"><span>
<apex:commandLink action="{!processOnSelected}" reRender="windowOpenPanel">Print
<apex:param name="commandAtt" value="print"/>
</apex:commandLink>
</span>
<apex:outputPanel id="windowOpenPanel">
<apex:outputPanel rendered="{!isOpen}">
<script type="text/javascript">
window.open('http://invoicedetails.dev.cs16.force.com/EnterCode/InvoicePDF?invoiceId={!idString}');
</script>
</apex:outputPanel>
</apex:outputPanel>
</li></ul>
但不会去类方法processOnSelected()。它给出了js错误
下面的actionUrl.indexOf不是函数
是我的控制器方法代码:
public void processOnSelected(){
String command = Apexpages.currentPage().getParameters().get('commandAtt');
idString = '';
isOpen=true;
Set<Id> selectedIdSet = new Set<Id>();
if (command=='print' || command=='payment') {
//wfdList = new List<WrapForDescription>();
//System.debug('__wfdList__'+wfdList);
for(WrapForDescription tmpList : wfdList) {
if(tmpList.checked) {
//WrapForDescription selected = new WrapForDescription();
//selected.wrapOpp = tmpList.wrapOpp;
//wfdList.add(selected);
selectedIdSet.add(tmpList.wrapOpp.Id);
idString+= tmpList.wrapOpp.Id+',';
//System.debug('__True__');
}
}
idString = idString.substring(0, idString.length()-1);
}
else if (command=='onePDF') {
idString = id;
}
Blob idBlob = Blob.valueOf(idString);
idString = Encodingutil.base64Encode(idBlob);
System.debug('__idString__'+idString);
System.debug('__selectedIdSet__'+selectedIdSet);
if (command=='payment') {
page = 'beforePaymentAll';
AggregateResult oppSumAmount = [select SUM(Amount) total from Opportunity where Id IN :selectedIdSet];
//accObj = [select Name, convertCurrency(Unpaid_Opportunity_Amount__c), convertCurrency(Paid_Opportunity_Amount__c) from Account where Id =:accId];
unpaid_amount = (Decimal)oppSumAmount.get('total');
oppList = [Select Id, Name, convertCurrency(Opportunity.Amount), Opportunity.CloseDate, Opportunity.CurrencyIsoCode, Opportunity.SecretCode__c From Opportunity o where Id IN :selectedIdSet order by CloseDate desc];
oppListSize = oppList.Size();
System.debug('__oppLineList__'+oppList);
isOpen=false;
}
}
这是给出错误的JS文件: http://invoicedetails.dev.cs16.force.com/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1339862070000
并且错误在这一行中给出
var ask = actionUrl.indexOf('?')
我的代码有什么问题。请帮助我。
答案 0 :(得分:1)
请发布processOnSelected方法的控制器代码。 我可以假设这种方法没有参数或它是私有的。
尝试更改
public void processOnSelected() {
...
}
到
public PageReference processOnSelected(string commandAtt) {
...
return null;
}