I recently signed up for the Winter ’09 pre-release trial (details here, and also see Nick’s post), so I started playing around with all the new goodies that are coming down the line (while waiting for a flight to start my holiday!).

One feature that caught my eye was the new pagination support in Visualforce. It’s so darn simple to use.

Check out the following image, which shows a list of account names, with “next” and “previous” links.


Here’s the code (straight from the docs):

I’ve highlighted the new bits:

  • The recordSetvar attribution on the page component. This associates the page with a new type of controller, the standard list controller. The attribute also indicates the variable name of the record collection. So for example, in this case it’s set to “accounts”, which is what the dataList component iterates over.
  • New methods, previous() and next()

You can easily control the number of records displayed in each page (it defaults to 25), by writing an extension:

As you can see, this simply calls the (new) setPageSize() method on the controller.

Have fun, and sign up for the Winter ’09 webinar for an overview of all new features!

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS