You need to sign in to do that
Don't have an account?

Help on pagination class
HI,
Am trying to paginate the below class,somehow hasprevioius & hasNext methods are not working as expected,is my code went some thing wrong please help me out
Am trying to paginate the below class,somehow hasprevioius & hasNext methods are not working as expected,is my code went some thing wrong please help me out
public class activeaccountscont { public acccont(ApexPages.StandardController controller){} public list<acccont> zsubLst{get;set;} public ApexPages.StandardSetController cont { get { if(cont == null) { cont = new ApexPages.StandardSetController(Database.getQueryLocator([select,id,name(Select id,Firstname from Contacts) From Account where Accountid = :ApexPages.currentPage().getParameters().get('id') AND Status__c = 'Active'])); } return cont; } set; } public List< acccont > zqu{ get { cont.setPageSize(5); return (List<acccont>) cont.getRecords(); } } // returns the first page of records public void first() { cont.first(); } // returns the last page of records public void previous() { cont.previous(); } public void last() { cont.last(); } public void next() { cont.next(); } public Boolean hasNext { get { return cont.getHasNext(); } set; } // indicates whether there are more records before the current page set. public Boolean hasPrevious { get { return cont.getHasPrevious(); } set; } }
try your query like this,
Let us know if it helps,
Thanks,
Balayesu
1) http://amitsalesforce.blogspot.com/2015/04/pagination-using-standardsetcontroller.html