Hello,

I'm trying to use the module on a view and it doesn't seem to work.

looks like the $pager_total is always 1 and so the pager isn't activated.

what could cause this?
this happens with a view with lots of rows.

Thanks

Idan

Comments

arbel’s picture

Title: Doesn't seem to work at all $pager_total always 1 » Infinite scroll doesn't work with a view of views

Ok, this isn't really an issue with infinite scroll but with views.

I had a view where each row had a view in it. this caused the pager not to appear in the "outer" view, if the "inner" views had a pager set.

But after resolving that the infinite scroll had trouble selecting the content, or rather selected to much, and appended the loaded content after each "inner" view.

I resolved this by changing this:

views_infinite_scroll.js (line24)

var content_selector = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' ' + settings.content_selector;

to
var content_selector = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + '>' + settings.content_selector;

and on views_plugin_pager_infinite_scroll.inc (line 38)

$content_selector = ' div.view-content .item-list > *';

to

$content_selector = ' div.view-content>.item-list > *';

simply made the selector more specific.

thanks

Idan

bryancasler’s picture

Hmmm.... seems to be even more generic than that. I have a view with "infinite scroll" displaying a content type's teaser view. That teaser view has a view pane in it.

The teaser setup (screenshot: http://snpr.cm/OeEXlL.png)
-A look at the "Artwork Description as a Link" view (screenshot: http://snpr.cm/wzlQVw.png)
A look at the infinite scroll view "Art Teaser Listing" (screenshot: http://snpr.cm/taO6EO.png)

The above patches didn't seem to help. I'm still getting several loading gif's on the screen at the same time. Basically one is appearing below each "view" that is on the screen.
Screenshot: http://snpr.cm/E6oy6A.png

You can see the bug live at (http://matttucker.onedogdevelopment.com/). Just scroll down.

The big thing is that the "Artwork Description as a Link" view doesn't even have a pager. So I'm completely unsure about why it's even being targeted.

bryancasler’s picture

Ok, so I figured out a solution based off of some of what was included in #1. Didn't even need to touch "views_plugin_pager_infinite_scroll.inc"

In views_infinite_scroll.js on lines 24-31

Change this...

          if(!use_ajax) {
            var content_selector = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' ' + settings.content_selector;
            var items_selector   = content_selector + ' ' + settings.items_selector;
            var next_selector    = settings.next_selector;
            var img_path         = settings.img_path;
            var img              = '<div id="views_infinite_scroll-ajax-loader"><img src="' + img_path + '" alt="loading..."/></div>';
            var img_location     = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' div.view-content'; 
            var pager_selector   = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' div.item-list ' + settings.pager_selector;

...to this...

          if(!use_ajax) {
            var content_selector = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' > ' + settings.content_selector;
            var items_selector   = content_selector + ' ' + settings.items_selector;
            var next_selector    = settings.next_selector;
            var img_path         = settings.img_path;
            var img              = '<div id="views_infinite_scroll-ajax-loader"><img src="' + img_path + '" alt="loading..."/></div>';
            var img_location     = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' > ' + ' div.view-content'; 
            var pager_selector   = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' > ' + ' div.item-list ' + settings.pager_selector;

Now everything is working just fine.

bryancasler’s picture

Status: Active » Needs review

Changing status

Remon’s picture

Excellent investigation guys! I'm going to commit that ASAP.

bryancasler’s picture

sweet! I'm always glad when I can help and contribute.

Remon’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.