Skip Navigation

[Resolved] Views pagination with Ajax reloads whole page instead

This support ticket is created 8 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 19 replies, has 4 voices.

Last updated by samB-3 8 years, 2 months ago.

Assisted by: Adriano.

Author
Posts
#365478
Capture.PNG

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?

#365554

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.

#366541

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).

#367080

Sorry, just not super clear. Are you saying this will be fixed in 1.12?

#367178

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.

#368795

Ah, I see. Thanks for the clarification. I see the new release is out so I will give it a try.

#368797

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?

#369218

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.

#369894

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?

#369905

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.

#371626

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);
});
#371628

Bob

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

#371869

Bob is right. Shall we close this thread? Can I help in anything else?

#372998

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!

#373004

Sure, show me and I will try to help you.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.