Standard Pagination Using Standard Controller based on RecordSetVar


<apex:page standardController="Opportunity" recordSetVar="opportunities" tabStyle="Opportunity" sidebar="false">
    <apex:form >
   
        <apex:pageBlock title="Edit Opportunities" >
            <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlockButtons >
              <apex:commandButton value="Save" action="{!save}"/>
              <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!opportunities}" var="opp">
                <apex:column value="{!opp.name}"/>
                  <apex:column headerValue="Stage">
                    <apex:inputField value="{!opp.stageName}"/>
                  </apex:column>
                  <apex:column headerValue="Close Date">
                    <apex:inputField value="{!opp.closeDate}"/>
                  </apex:column>
            </apex:pageBlockTable>
            
            <apex:panelGrid cellpadding="5" cellspacing="5" columns="5" >
                <apex:commandButton value="First" action="{!first}"/>
                <apex:commandButton value="Previous<<<" action="{!previous}" rendered="{!HasPrevious}" />
                <apex:commandButton value="Next>>>" action="{!next}" rendered="{!HasNext}" />
                <apex:commandButton value="Last :)" action="{!last}"  />
                <apex:panelGroup >
                    <apex:outputText value="Records/Page"></apex:outputText>&nbsp;&nbsp;
                    <apex:selectList value="{!PageSize}" size="1">
                        <apex:selectOption itemValue="5" itemLabel="5"></apex:selectOption>
                        <apex:selectOption itemValue="10" itemLabel="10"></apex:selectOption>
                        <apex:selectOption itemValue="15" itemLabel="15"></apex:selectOption>
                        <apex:selectOption itemValue="40" itemLabel="40"></apex:selectOption>
                    </apex:selectList>&nbsp;&nbsp;
                    <apex:commandButton action="{!NULL}" value="Update Page Size"/>
                </apex:panelGroup>
           </apex:panelGrid>
         </apex:pageBlock>
    </apex:form>
</apex:page>

SnapShot:


Thanks,
Sumit Shukla




Comments

Popular posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page