function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pallavi GholePallavi Ghole 

pageBlockTable not displaying data

I am currently on a VisualForce course by Matt Lacey and having trouble with the Apex code for DataList / PageBlockTable. 
Though my apex code does not show any errors the page does not display any records. Any help/direction would be appreciated.

Here is the Code
=============

<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock title="Account List">
        <apex:pageBlockTable value="{!accounts}" var="acct">
            <apex:column >
                <apex:outputField value="{!acct.Name}"/>
            </apex:column>
            <apex:column >
                <apex:outputField value="{!acct.Rating}"/>
            </apex:column>
        </apex:pageBlockTable>    
    </apex:pageBlock>
</apex:page>




Any idea what I may be doing wrong?  
Or is there a setup needed to display this data? 


Regards
Pallavi
Best Answer chosen by Pallavi Ghole
Raj VakatiRaj Vakati
Your code is correct ... But recordSetVar will show the data from the from the ListView which you access currently. Please change the list view on account object to All Accounts or my accounts and try to reload your visualforce page 

User-added image 


 

All Answers

Raj VakatiRaj Vakati
Your code is correct ... But recordSetVar will show the data from the from the ListView which you access currently. Please change the list view on account object to All Accounts or my accounts and try to reload your visualforce page 

User-added image 


 
This was selected as the best answer
Pallavi GholePallavi Ghole
An Edit to my post ==>>

OK so an interesting thing is - THe page is showing me a new account that I created after I finished writing this VF code but it still does not show me existing account records. Not sure why
Pallavi GholePallavi Ghole
Edit to my post ==>

An interesting thing is - It is showing me a new account that I created after I finished writing this VF code but it still does not show me existing account records. 
Raj VakatiRaj Vakati
"recordSetVar" will show the data from the from the ListView which you access currently. --- >> If you wanted to show all the data  Use standard set controller 
Pallavi GholePallavi Ghole
Thanks a lot Rav V !
Your response below helped!
"Your code is correct ... But recordSetVar will show the data from the from the ListView which you access currently. Please change the list view on account object to All Accounts or my accounts and try to reload your visualforce page "