我正在为 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 不是函数
下面是我的控制器方法代码:
公共无效进程OnSelected(){
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('?')
我的代码有什么问题。任何人请帮助我。