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

Possible bug in StandardSetController setPageNumber

if I call




IT ALWAYS sets the pagenumber to 1 regardless of what the apexPages parameter


If I However do:


Public Integer tstPg = integer.valueOf(ApexPages.CurrentPage().getParameters().get('pgNum')));



it sets the page just fine no matter what the ApexPage Parameter is. If it is 2, the page is set to 2


Any one have any ideas?



I've had this happen if I haven't set the PageSize. 




I can definitely confirm Scott.M - you must do the calls in this order:
This makes sense in that without knowing the pageSize to apply to the ssc result list, the pageNumber is meaningless - That is, if pagesize = 20, setting pagenumber to 2 will start at record 21st in the list but if pageSize is unknown, what does pageNumber 2 mean?  Now, one could argue that these values should be order independent as it is the getRecords() method call that matters but the implementation does not appear to work this way. I've filed a request to have the doc updated
Venkat PolisettiVenkat Polisetti
Good catch! It helped me well. Thanks.