2017-04-17 48 views
0

我想添加一個自定義的VF組件來在頁面塊表中顯示批處理作業的詳細信息。然而,我的組件不存在,它說:錯誤錯誤:只讀屬性'c:batchDetailsComponent.BatchJobDetails' 請幫助。如何在visualforce自定義組件中使用頁面塊表?

這是visualforce組件:

<apex:component controller="BatchOpportunityDetailsExtension"> 
     <apex:attribute name="batchJob" type="List" assignTo="{!BatchJobDetails}" description="" /> 
      <apex:form > 
       <apex:pageBlock> 
        <apex:pageblockTable value="{!batchJob}" var="batch"> 
         <apex:column value="{!batch.CompletedDate}"/>  
         <apex:column value="{!batch.JobItemsProcessed}"/>  
         <apex:column value="{!batch.NumberOfErrors}"/> 
        </apex:pageblockTable> 
       </apex:pageBlock> 
      </apex:form> 
    </apex:component> 

VF頁:

<apex:page standardController="Opportunity_Scheduled_Information__c" 
    extensions="BatchOpportunityDetailsExtension"> 
     <c:oppScheduleComponent componentValue="{!batchJob}"/> 
    </apex:page> 

控制器:

public class BatchOpportunityDetailsExtension { 

public List<AsyncApexJob> batchJobDetails = new List<AsyncApexJob>();  
public Opportunity_Scheduled_Information__c pageController {get;set;} 
public BatchOpportunityDetailsExtension() {} 

public BatchOpportunityDetailsExtension(ApexPages.StandardController controller) { 
controller.addFields(new List<String>{'Total_Amount__c', 'Number_of_Opportunities__c'}); 
pageController = (Opportunity_Scheduled_Information__c)controller.getRecord(); 

BatchJobDetails = [ SELECT id,ApexClassID,CompletedDate,JobType,JobItemsProcessed,NumberOfErrors,MethodName,Status,ExtendedStatus,TotalJobItems FROM AsyncApexJob WHERE ApexClassId='01p7F000000bKIlQAM' LIMIT 50] ; 

} 

public List<AsyncApexJob> getBatchJobDetails() 
{ 
    return BatchJobDetails ; 
} 
} 

回答

0

您需要爲您的組件的訪問設置爲global
喜歡這個:<apex:component access="global" controller="BatchOpportunityDetailsExtension">

相關問題