I'm using Views Infinite Scroll with some exposed filters, and "Use Ajax" is set to "Yes". If I choose a combination of filters that will result in no results being returned and then click "Apply", I get the following Javascript error:

Uncaught TypeError: Cannot read property 'top' of null
Drupal.behaviors.views_infinite_scroll.attach @ views_infinite_scroll.js:76

Patch to follow.

CommentFileSizeAuthor
#2 2556715-1.views_infinite_scroll-ajax.patch624 bytesjrb
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jrb created an issue. See original summary.

jrb’s picture

Status: Active » Needs review
FileSize
624 bytes

Patch attached.

vood002’s picture

This patch solved the problem for me, ty!

Baysaa’s picture

I couldn't get the views Preview working when the display has Infinite Scroll as the pager set. Patch at #2 fixes my issue. However, the JS error still appears in the console log (although it doesn't break Views admin).

This time the message is generated from jquery.autopager.js around line 133:

function loadOnScroll() {
		if (content.offset().top + content.height() < $(document).scrollTop() + $(window).height()) {
			$.autopager.load();
		}
	}

Uncaught TypeError: Cannot read property 'top' of null

Honza Pobořil’s picture

Status: Needs review » Closed (outdated)

7.x-1.x will receive no work. Migrate to 7.x-2.x.