What I'm trying to resolve is when site visitors navigate to page 4 of 20 for example in the listings view and then click a listing to view details (i.e. custom post type) then click the BACK button in their browser what I expect is that they go back to page 4 of 20 – where they left off. But instead they are taken back to page 1 of the listings view. And when it takes you back to page 1, the pagination at the bottom shows the wrong page #; if you were on page 4 then is says page 4 even though the results loaded page 1.
I've read in the forums that enabling the "Browser History Management" should help, which I've enabled under the individual settings and under the Toolset Settings. But my URL doesn't show any parameters at all. I assume some of my other settings are not correct and that's why it's not working. However, if there is another way to solve my issue, so that site visitors are taken back to where they left off in their browsing/searching please let me know.
I'm happy to share credentials for you to access the WordPress dashboard as well, if needed. Thanks.
Can you let me know how your view was built ? Was it build using the block editor by going to a Page and creating a new Page then using the View block to create a new view ?
Or was it done by going to Toolset -> Views -> Add New.
Either way the steps should be similar:
A. If you've created your view using the view block, you will need to use the Block navigator at the top left of your editor. Then select your Pagination. From there a sidebar for the block should open to the right. You will need to scroll down to the "View Pagination Settings" and expand the accordion for the section. If you have "Pagination enabled with manual transition and AJAX" then you should see a few other options including "Browser History Management". Ensure that "Update the URL of the page when paginating the View" is selected.
B. If you've created your view using the classic method by going to Toolset -> Views. From here you will need to edit your view and scroll to the "Pagination and Sliders Settings" ensuring that "Pagination enabled with manual transition and AJAX" is selected. Finally under "Browser history management" ensure that both options are selected.
Yes, I've enabled it under the View settings and under the Settings > Front-End Content section. See screenshots. But my URL is still remaining the same when paging through.
I've checked and saw that it is in face the Pagination URL Parameter is not getting added.
At this point I cannot be sure what is the cause of the issue because further testing needs to be done. Given that this is a live site I would like to grab a copy using the duplicator plugin.
From there I can setup a local copy of the site and perform further testing. This can help to eliminate the server being the issue.
I have a little bit of Good news for you and a bit of bad.
The Good news is that if you create a completely new view and remake it and test the pagination as you go along it works fine.
You old view still doesn't work. This leads me to suspect the view itself being the culprit given that the new view I made works even when I copied a few components from the old view.
Please try doing this on your end and let me know if the results are the same.
That worked. I tried rebuilding the view and determined that the issue was related to a JS code I had input to make the page scroll to top after pagination. I found the information for this JS in the Toolset forum: https://toolset.com/forums/topic/scroll-to-top-after-ajax-pagination/
Since I've had to remove the JS, I still need to find a way to have the page scroll back to top after pagination - especially on mobile. Can you advise on why the above didn't work or if there is another solution? I'm not sure if I had the code in the wrong place or if there is a different issue with it.
Without changing the code all you need to do is to remove it from the section here. See Screenshot
The function was already wrapped in the callback function for the pagination and you've already added it to the JS section of your view so no need to have it here again.
This should fix it now while maintaining the custom code functionality.
I've also tested this in the duplicate of your website so it should also work for you.