You need to sign in to do that
Don't have an account?
Brad Nordling 9
How can I have a PageBlockTable get its records from a method on the controller?
I have a pageBlockTable on a VF page and I want to specify what records to populate it with. If I use the RecordSetVar, it uses ALL the records in that object. I want a sub-set of the records, with my specific parameters specified. I tried a method in the controller extension and wanted to specify that in the value attribute of the pageBlockTable but the code never executed so that was a bust. How else might I do this?
This is part of the page:
<apex:page standardController="Privilege_Assessment_Record__c" extensions="PrivilegeAssessmentObjectExtensionBulk" recordSetVar="NewBatch">
<apex:form >
<apex:pageBlock title="Enter Field Values" id="skills_list">
<apex:PageBlockTable value="{!NewBatch}" var="record">
<apex:column value="{!record.Name}"/>
<apex:column value="{!record.RecordType.Name}" headerValue="Record Type"/>
Here's the method in the controller:
public static List<Privilege_assessment_record__c> NewBatch() {
string myParam = ApexPages.currentPage().getParameters().get('bulkBatchID');
return [
SELECT Id, Name, Method_of_Review__c, Patient_MRN__c,
Diagnosis_Procedure__c, Benchmark_Threshold_for_success__c,
Result__c, recordType.Name, bulkBatchID__c
FROM Privilege_assessment_record__c
WHERE bulkBatchID__c = :myParam
];
}
This is part of the page:
<apex:page standardController="Privilege_Assessment_Record__c" extensions="PrivilegeAssessmentObjectExtensionBulk" recordSetVar="NewBatch">
<apex:form >
<apex:pageBlock title="Enter Field Values" id="skills_list">
<apex:PageBlockTable value="{!NewBatch}" var="record">
<apex:column value="{!record.Name}"/>
<apex:column value="{!record.RecordType.Name}" headerValue="Record Type"/>
Here's the method in the controller:
public static List<Privilege_assessment_record__c> NewBatch() {
string myParam = ApexPages.currentPage().getParameters().get('bulkBatchID');
return [
SELECT Id, Name, Method_of_Review__c, Patient_MRN__c,
Diagnosis_Procedure__c, Benchmark_Threshold_for_success__c,
Result__c, recordType.Name, bulkBatchID__c
FROM Privilege_assessment_record__c
WHERE bulkBatchID__c = :myParam
];
}
public with sharing class PrivilegeAssessmentObjectExtensionBulk{
public List<Privilege_Assessment_Record__c> NewtBatch {get; set;}
public PrivilegeAssessmentObjectExtensionBulk(ApexPages.StandardSetController stdController) {
string myParam = ApexPages.currentPage().getParameters().get('bulkBatchID');
assessmentBatch = new List<Privilege_Assessment_Record__c>();
for(Privilege_Assessment_Record__c par: [SELECT Id, Name, Method_of_Review__c, Patient_MRN__c, Diagnosis_Procedure__c,
Benchmark_Threshold_for_success__c, Result__c, recordType.Name, bulkBatchID__c
FROM Privilege_assessment_record__c WHERE bulkBatchID__c = :myParam]) {
AssessmentBatch.add(par);
}
}