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
HemanthrulezHemanthrulez 

Pagination in VisualForce

Hi,

 

How do I achieve pagination using enhancedList? I have a Custom Object  - Department with department number(Auto Number) as standard field and Department name as custom field. I have 26 entries in the table.

 

I have to list 10 entries per page using enhanced List. While doing this, I am not able to view the department names in the VF page. I just notice 1-26 numbers divided into 3 pages.

 

VisualForce Page - DisplayPagination

 

<apex:page controller="department">
 <p>Display Records</p>
<apex:enhancedList type="department__c" height="400" rowsPerPage="10" customizable="false" id="Display"/>
 </apex:page>

 

 

Controller

 

 

public class department {
    public List<department__c> getDepartments() {
        return [select name,department__c.Department_Name__c from department__c order by LastModifiedDate asc];
    }


}

 

 

 

 

 

Please suggest me a solution to it.

Scott_VSScott_VS

You will have to utilize the StandardSetController to use pagination on a Visualforce page.

 

This blog post may help get you going:

 

http://blog.jeffdouglas.com/2009/07/14/visualforce-page-with-pagination/