Skip Navigation

[Resolved] Toolset View – Infinite scroll not working

This thread is resolved. Here is a description of the problem and solution.

Problem: Toolset View - Infinite scroll not working, stop infinite scroll trigger

Solution: There is a new javascript/jQuery workaround to stop infinite scroll automatic trigger.

You can find the proposed solution in this case with the following reply: https://toolset.com/forums/topic/toolset-view-infinite-scroll-not-working/#post-2084225

Relevant Documentation:

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.

Our next available supporter will start replying to tickets in about 2.78 hours from now. Thank you for your understanding.

This topic contains 6 replies, has 2 voices.

Last updated by Paul Marconi 4 months, 2 weeks ago.

Assigned support staff: Minesh.

Author
Posts
#2079727
error.PNG
Capture.PNG

Hi there,

I've created a view that has Infinite scroll with the load more button, it used to work, but now it doesn't.
I have added this code below in the Loop editor JS section to remove auto-load (which use to work before)
jQuery(function($){
WPViews.view_pagination.is_infinite_triggable = function(view_layout){return false; }
});

In the console, there's this error "jquery.min.js?ver=3.5.1:2 Uncaught ReferenceError: WPViews is not defined" (screenshot attached), so I believe that's the reason why it's not working. I can't seem to fix that 'WPViews is not defined' error.

It seems after updating the toolset view plugin to the latest version, it start to have this error. Can this be fixed?

Thanks!

#2079773

Just to add, when I downgraded the toolset view plugin to version 3.4.2, it's working again.
So all the versions of 3.5 and up are not working for me. It's giving me the 'Uncaught ReferenceError: WPViews is not defined' error message.

#2080239

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

With the latest views/blocks plugin the pagination script is not enqueued on pages without pagination. Infinite scroll doesn't count as pagination, so to access the WPViews object you will need to enqueue the script manually, because of the asset optimisation changes to avoid loading scripts where not needed.

Can you please try to add the following code to your theme's functions.php file and see it that help you to resolve your issue.

add_action( 'wpv_action_require_frontend_assets', function () {
    if (!is_admin()) {	
          
	   wp_enqueue_script(
			'classic-pagination-script',
			WPV_URL . 'https://cdn.toolset.com/embedded/res/js/wpv-pagination-embedded.js',
			[ 'jquery'],
			WPV_VERSION,
			true
		);
	       
    }
}, PHP_INT_MAX );
#2080553
Capture2.PNG
Capture.PNG

Thank Minesh! The error is gone in the console, but the load more button is still not resolved yet.

Under 'Pagination and Sliders Settings', I've selected 'Pagination enabled with manual transition and AJAX' and in the Pagination options, the Transition effect is Infinite scrolling (Capture.PNG screenshot). Removing the auto-load js code isn't working which used to work (Capture2.PNG screenshot):

jQuery(function($){
WPViews.view_pagination.is_infinite_triggable = function(view_layout){return false; }
});

This is a working version (with toolset view plugin version 3.4.2):
hidden link

This is not a working version (latest version of the toolset view plugin ):
hidden link

As you can see on the working version, when you scroll down near the end, the load more button stays in the view , so the js code for removing the auto-load works. If you click on it, it will load more posts. But now with the latest version of the toolset view plugin, once you scroll near the end, the load more button is visible for a second then disappears, so the js code for removing the auto-load isn't working.

Does this code work anymore? Or is there a new code for removing the auto-load if the Transition effect is 'Infinite scrolling'?
jQuery(function($){
WPViews.view_pagination.is_infinite_triggable = function(view_layout){return false; }
});

Thank you

#2081453

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've escalated the issue to our next level support. I'll get in touch with you as soon as I know more.

#2084225

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please try to use the following code and try to resolve your issue:

(function ($) {
    $(document).ready(function () {
 
        $('.js-wpv-layout-infinite-scrolling').removeClass('js-wpv-layout-infinite-scrolling');
 
    });
})(jQuery);
#2084667

Thank you Minesh! My issue is resolved now.
Replacing this:
jQuery(function($){
WPViews.view_pagination.is_infinite_triggable = function(view_layout){return false; }
});

with the new code that you provided fixed the issue.

Thanks again!