2017-04-17 2 views
0

Je souhaite ajouter un composant VF personnalisé pour afficher les détails du travail par lots dans une table pageblock. Cependant, mon composant ne sauve pas, il dit: Erreur Erreur: Lecture seule propriété 'c: batchDetailsComponent.BatchJobDetails' S'il vous plaît aider.Comment utiliser une table de blocs de pages dans un composant personnalisé Visualforce?

C'est le composant 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 Page:

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

Controller:

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

Répondre

0

Vous devez définir l'accès pour votre composant à global.
Comme ceci: <apex:component access="global" controller="BatchOpportunityDetailsExtension">