You need to sign in to do that
Don't have an account?
next and previous pageination not working in Custom List Controller
I dont want to write my own pageination methods if salesforce already has them. In the cookbook section called 'Selecting Records with a Visualforce Custom List Controller ' it says you can use standard list controller actions ({!previous} and {!next}), but its not working for me. Can you see what I am doing wrong?
public with sharing class commentPagination { private final Quote_Comment__c comment; public commentPagination(ApexPages.StandardSetController controller) { this.comment = (Quote_Comment__c)controller.getRecord(); } public ApexPages.StandardSetController comments{get { if(comments == null) { return new ApexPages.StandardSetController(Database.getQueryLocator([SELECT name,comment__c FROM Quote_Comment__c ])); } return comments; } private set; } public List<Quote_Comment__c> getCommentPagination() { return (List<Quote_Comment__c>) comments.getRecords(); } public integer listSize {get; set;} {listSize = comments.getRecords().size();} }
<apex:page standardController="Quote_Comment__c" recordSetVar="comments" extensions="commentPagination"> <apex:pageBlock title="Viewing {!listsize} Comments"> <apex:form id="theForm"> <apex:pageBlockSection columns="1"> <apex:dataList var="c" value="{!commentPagination}" type="1"> {!c.name} </apex:dataList> </apex:pageBlockSection> <apex:panelGrid columns="2"> <apex:commandLink action="{!previous}"> Previous </apex:commandlink> <apex:commandLink action="{!next}"> Next </apex:commandlink> </apex:panelGrid> </apex:form> </apex:pageBlock> </apex:page>
Walter,
Check out my blog post (code and demo) for pagination with Visualforce and Apex.
HTH
Jeff Douglas
Appirio, Inc.
http://blog.jeffdouglas.com
All Answers
Walter,
Check out my blog post (code and demo) for pagination with Visualforce and Apex.
HTH
Jeff Douglas
Appirio, Inc.
http://blog.jeffdouglas.com