
Hi Greg,I have made some minor changes in your controller class to call the data fetching in both constructor as well as Save() method. Here is the code.
And, I suggest you use reRender option on the Save button, to rerender your second section.Line 26 of your VF page would be like this.public class TestCaseController {
public class Lists{
public Test_Case__c testcase{get;set;}
public List<Related_Test_Record__c> test1{get;set;}
public Lists(){
this.testcase = new Test_Case__c();
this.test1 = new List<Related_Test_Record__c>();
}
}
public List<Lists> lstList{get;set;}
//public List<Lists> lstTestCases{get;set;}
public List<Lists> lstTest1{get;set;}
public Boolean cbTest{get;set;}
public PageReference save(){
fetchData();
return null;
}
public TestCaseController(){
if(cbTest == null)
cbTest = false;
if(lstList == null)
lstList = new List<Lists>();
//lstTestCases = new List<Lists>();
fetchData();
}
public void fetchData(){
//cbTest = System.currentPageReference().getParameters().get('cbTest');
List<Test_Case__c> lstTestCases = [SELECT Id, Name,
RecordType.Name, Status__c
(SELECT Id FROM Related_Test_Record__c),
FROM Test_Case__c];
if(lstTestCases.size()>0){
for(Test_Case__c testcase:lstTestCases){
Lists lst = new Lists();
lst.testcase = testcase;
if(testcase.Related_Test_Record__r.size() > 0){
lst.test1 = testcase.Related_Test_Record__r;
}
if(cbTest == true && testcase.Top_List__c == true){
lstList.add(lst);
//cbTest == null is included because I wanted records to render even if my custom checkbox isn't passing a value currently
} else if(cbTest == false){
lstList.add(lst);
}
}
}
}
}
<apex:pageBlock title="Case Report" id="CaseReport">
And, line 21 would be..
Let me know if this works for you.<apex:commandButton action="{!save}" value="Update Report" rerender="CaseReport"/>
5 个回答