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
MrBungleMrBungle 

Pagination with persisting values entered by user

Are there any textbook examples that Salesforce provides in their apex/visualforce documentation guides that outline how to have a pageblock table with pagination that remembers the values that users enter as they navigate through pages of records? From what I can see there is not. I have seen non-salesforce articles that describe how to achieve this. Any pointers to official Salesforce documents on how to do this would be greatly appreciated. Thank you!
 
Best Answer chosen by MrBungle
James LoghryJames Loghry
Simply put, you're not going to find it.  The "official documentation" on pagination is centered around the StandardSetController, as I highlighted above, but will likely not work for your solution.  The best you're going to get is finding a reputable blog, like the one I posted above or simply coming up with a solution on your own.

All Answers

James LoghryJames Loghry
Yes! If you're paginating through sObjects, this is rather straight forward using the StandardSetController.  In essence, you'll initialize the StandardSetController with your list of sobjects, and then use the controller's next, previous, and other methods to paginate through your collection.  Note, if you're paginating through a wrapper class or something that is not sobjects, then you'll have to use a different solution.  See the last example:  http://www.salesforce.com/docs/developer/pages/Content/pages_custom_list_controller.htm
James LoghryJames Loghry
After re-reading your message above, the StandardSetController might not be your best solution because you mentioned persisting values.  It sounds like you may be looking at some wrapper class and your own pagination solution unfortunately.
MrBungleMrBungle
Hi James,

Thank you kindly for your response! I really appreciate it! I think that there probably is not any official Salesforce documentation on how to do this. Does anyone else know of any? Thanks!
James LoghryJames Loghry
MrBungle,

Here's the best example I've found so far: http://www.sundoginteractive.com/sunblog/posts/server-side-pagination-in-apex-visualforce-for-custom-classes.  Note this is "server side pagination".  You could also look into client side pagination with a javascript library like angular data tables, or jquery, etc.
MrBungleMrBungle
Hi James,

Thanks again for your input. You are very kind and I appreciate it. I am specifically looking for official Salesforce documentation on how to do this. I have seen a lot of non-Salesforce solutions to this.
James LoghryJames Loghry
Simply put, you're not going to find it.  The "official documentation" on pagination is centered around the StandardSetController, as I highlighted above, but will likely not work for your solution.  The best you're going to get is finding a reputable blog, like the one I posted above or simply coming up with a solution on your own.
This was selected as the best answer
MrBungleMrBungle
Thanks James. You are the man.