【问题标题】:How to use a page block table in a visualforce custom components?如何在 visualforce 自定义组件中使用页面块表?
【发布时间】:2017-04-17 06:43:10
【问题描述】:

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

这是视觉力组件:

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

【问题讨论】:

    标签: salesforce batch-processing apex-code visualforce


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多