I am prepared to be flamed for asking such a newbie question (which is similar to others) but I'll suffer the shame if I can get this resolved. Since my background is mostly procedural code, I'm studying SalesForce's "VisualForce in Practice" and am coding as I go. In Chapter 4 (list controllers), they have me list contacts and (supposedly) have Next/Previous buttons appear.
When I code the following, no buttons appear. I know that the rendered is evaluating as false (because the buttons don't appear) and suspect that the code doesn't exist for HasPrevious/HasNext. In the examples I've seen (Display more than 3000 records in a VF page and http://forceguru.blogspot.in/2011/04/pagination-in-salesforce.html), they have a controller which has code for HasPrevious/HasNext. The book discusses a standardSetController but doesn't prompt me to write any code for it.
If I'm using a standardController, then shouldn't this code exist? I'm not supposed to write an extension for this, am I? If not, why do the buttons not show?
Thanks.
Mike
Code:
<apex:page standardController="Contact" recordSetVar="contacts">
<apex:form >
<apex:pageBlock title="Simple Contact List">
<apex:pageBlockTable value="{!contacts}" var="c" rows="5">
<apex:column value="{!c.Id}"/>
<apex:column value="{!c.FirstName}"/>
<apex:column value="{!c.LastName}"/>
<apex:column value="{!c.Email}"/>
</apex:pageBlockTable>
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandLink action="{!Previous}" value="Previous Page" rendered="{!HasPrevious}"/>
<apex:commandLink action="{!Next}" value="Next Page" rendered="{!HasNext}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:pageBlock>
</apex:form>
</apex:page>