如何在visualforce自定义组件中使用页面块表?

时间:2017-04-17 06:43:10

标签: salesforce batch-processing apex-code visualforce

我想添加自定义VF组件以在页面块表中显示批处理作业详细信息。但是我的组件保存,它说:错误错误:只读属性'c:batchDetailsComponent.BatchJobDetails' 请帮忙。

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

1 个答案:

答案 0 :(得分:0)

您需要将组件的访问权限设置为global 像这样:<apex:component access="global" controller="BatchOpportunityDetailsExtension">