After upgrading to the latest version of views (1.11.1) and wordpress (4.4.2) I've found that pagination using Ajax doesn't work. I'm using the pagination option "Pagination updates only the view (use AJAX)" but the full page reloads when I click on "next" or "previous". Ajax pagination worked fine with views (1.5.1) and wordpress (3.9.11).
What info do you need from me to help figure this out?
Dear Sam,
Thanks for the details, I can duplicate same problem in my localhost, and put it into our to-do list, our developers will take care of it.
Views 1.11 added history management, which means that users will be able to interact with AJAX-powered pagination by clicking the back and forward. By no means the page is being reloaded. Only the UR is being adjusted.
Views 1.12 is adding a way to disable this, on a global way (for all Views) or on a View-based way (just for the current View).
Sorry, just not super clear. Are you saying this will be fixed in 1.12?
Hello,
What happens is that in Views 1.11 even with AJAX enabled the URL changes, but in 1.12 we've implemented a way to disable this behavior, so you can use AJAX without changing the URL. We should release this until the end of the week. Thank you for your understanding.
Ah, I see. Thanks for the clarification. I see the new release is out so I will give it a try.
Is the fix the "Browser history management"? If so I tried disabling that both locally and globally but the page URL is still changed -- hence full page reload -- when clicking next/previous.
Am I missing something?
Yes, that's the option.
I need to request temporary access (wp-admin and FTP) to your site in order to be offering better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Unfortunately I do not have permission to do this as it's a private site and the site owner would rather not do this. Is there any other way we can figure this out?
Can you reproduce the issue in another site that I can get access? I'm asking that because I couldn't reproduce the problem in my local tests.
Ok, I figured out the problem. I have a jQuery function that scrolls back to the top when the next or previous is clicked so users don't have to manually do that but it seems to interfere and cause the the URL to change even if it's set not to.
This is the jQuery code I'm using. Do you have any ideas how I can modify it so that this and the AJAX pagination can work in harmony? 🙂
jQuery(document).on('click','.wpv-filter-previous-link,.wpv-filter-next-link', function() {
$('html, body').animate({
scrollTop: ($('.filter-submit').offset().top)
},700);
});
Hi Sam,
Just been working on my site around that area as well.
What you should do is use front-end events rather than 'click'. You'll find these available in the JS editor.
The one you need is...
jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
/**
* data.view_unique_id (string) The View unique ID hash
* data.effect (string) The View AJAX pagination effect
* data.speed (integer) The View AJAX pagination speed in miliseconds
* data.layout (object) The jQuery object for the View layout wrapper
*/
});
Cheers,
Bob
Bob is right. Shall we close this thread? Can I help in anything else?
Thanks for the tip. I've tried everything I can think of but can't get this to work. Would one of you have time to help me adapt the script I was using? If so I'd super appreciate it. Thank you very much!
Sure, show me and I will try to help you.