What is Standard List Controllers?
By using standard standard list controllers we can manage set of records. For every standard controller there exists a standard list controller that allows you to create pages that display and act on a set of records, such as list pages, related lists, and mass action pages. We can associate define standard list controller by using recordSetVar.
<apex:page standardController="Account" recordSetVar="accounts">
Standard list controller provides additional four pagination actions. Those are first, last, next and previous.
We can use standard list controllers with the following objects.
Account, Asset, Campaign, Case, Contact, Contract, Idea, Lead, Opportunity, Order, Product2, Solution, User, Custom Objects.
Standard list controller example:
<apex:page standardController="Account" recordSetVar="accounts">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!Accounts}" var="a">
<apex:column headerValue="Account Name">
<apex:outputField value="{!a.name}"/>
</apex:column>
</apex:pageBlockTable>
<!-- pagination actions supported by standard list controller -->
<apex:pageBlockButtons >
<apex:commandButton value="First" action="{!first}"/>
<apex:commandButton value="Last" action="{!last}"/>
<apex:commandButton value="Next" action="{!next}"/>
<apex:commandButton value="previous" action="{!previous}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Post a Comment