I am trying to list the existing records for the current user in my VF Page:
here is the start of my page with the controller and extension defined:
<apex:page id="ChangeRequestList" StandardController="Request_for_System_Change__c" extensions="RequestForSystemChangeControllerList"
standardStylesheets="false"
showHeader="false" >
<head>
<title>Requests</title>
</head>
here is the code for the did that will hold the list:
<div class="blueBorder WidthAuto" id="ListRecs">
<apex:pageblock >
<br/>
<apex:commandButton value="List Records" action="{!fetchRecords}" rerender="pbTable"/>
<apex:pageblocktable value="{!listRecords}" var="a" id="pbTable" rendered="{!showRecords}">
<!-- Name, Owner.Name, Status__c, recordTypeId-->
<apex:column value="{!a.Name}"/>
<apex:column value="{!a.Owner.Name}"/>
<apex:column value="{!a.Status__c}"/>
<apex:column value="{!a.recordTypeId}"/>
</apex:pageblocktable>
</apex:pageblock>
here is my controller:
public with sharing class RequestForSystemChangeControllerList {
private Request_for_System_Change__c objRequest_for_System_Change;
public List<Request_for_System_Change__c> listRecords {get;set;}
public RequestForSystemChangeControllerList(ApexPages.StandardController stdCtrl) {
//objRequest_for_System_Change = (Request_for_System_Change__c)stdCtrl.getRecords();
showRecords =false;
//Request_for_System_Change__c[] allRequests =
//[select name from Request_for_System_Change__c where ownerid=:userInfo.getUserID()];
}
public Boolean showRecords{get;set;}
//In constructor
public void fetchRecords(){
listRecords = [Select Name, Owner.Name, Status__c, recordTypeId from Request_for_System_Change__c
where ownerid=:userInfo.getUserID()];
system.debug('records returned' + listRecords.size());
// you need to place a limit of 1000 as VF supports max of 1000 recors to be displayed
showRecords = true;
}
}
when Preview
the vf page, I see the div
with the command button List Records.
I click the button, and in the Developer Console logs I can see that 3 records have been returned but the table is not being displayed:
14:59:09:188 USER_DEBUG [23]|DEBUG|records returned3
so what am I doing wrong here?
Thanks