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

StandardSetController SAVE returns to 1st page



The StandardSetController that allows VisualForce pages and Apex to paginate through the records has a "Save" method. According to SalesForce documentation:



Inserts new records or updates existing records that have been changed. After this operation is finished, it returns aPageReference to the original page, if known, or the home page.



The issue that I am facing right now is everytime I make an update to any of the records and use the save method provided by that query, it always returns me to page 1.


For example, if I go to page 3, make an update, and perform a "Save" it always returns to the first page. I thought that it should return to the original page (which is the current page you are on). Am I misunderstanding the documentation? 


It is returning you to the original vf page.  The page originally loads with you on page 1 / ? of your result list.


Edit: Build a custom save method or make the page figure out what "page of results" you were last on in the constructor.


I did that, but it requires me to re-query the standard set controller. Is there any way I wouldn't have to re-query the set?