2012-06-15 25 views
0

我正在爲force.com站點開發一個visualforce頁面。我正在使用apex命令鏈接來執行某些操作。代碼如下:命令鏈接salesforce中的reRender

<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> 

但不會去class processOnSelected()。這是給JS錯誤

actionUrl.indexOf is not a function

下面

是我的控制器方法代碼:

公共無效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('?')

我的代碼有什麼問題。有人請幫助我。

回答

1

請發佈processOnSelected方法的控制器代碼。 我可以假設這種方法沒有參數或它是私人的。

嘗試改變

public void processOnSelected() { 
... 
} 

public PageReference processOnSelected(string commandAtt) { 
... 
return null; 
} 
+0

它仍然沒有工作。該processOnSelected()函數未被調用,我已經檢查調試。 – Chirayu

+0

即使它沒有參數? 'public PageReference processOnSelected()' –

+0

或嘗試使用'