Video: 005 – Restore screen position after refresh
Picture a Report and Form pages used to edit records. The Report is an Interactive Report and the edit page is Modal. When the modal closes the IR refreshes, but also, the page jumps to the top after the refresh. This happens in APEX 5.0.4.00.12. If your report is small this is never an issue, but with longer reports, this is pretty annoying to the user.
I wouldn’t be surprised if this gets fixed in a not so distant new version of APEX, but in the meantime, here’s a simple workaround. Oh and if you have any recommendations, improvements, questions, or suggestions I would love to hear about them.
Check out the demo.
I think my friend Gemma Wood first told me about this fix. I couldn’t find the actual code she shared with me, but the basic approach is pretty simple. Save the scroll position of the page before you open the modal page. Restore the scroll position after the refresh.
Here are the more detailed steps or, if you like, watch the video below:
- Add a DA on click of the link used to invoke a modal page. It will save the current scroll position, so call it “Save Scroll Position”
savepos = $(window).scrollTop();
- Create an “After Refresh” Dynamic Action to restore the postion.