For some reason my "Ajax" portion of views has stopped working on my current site the error I get via Chrome is:

ncaught TypeError: Object #<Object> has no method 'scrollTop'
$.each.$.filter.filter.each.$.addClass.find.each.$.click.$.ajax.successjs_ae2f29664b5756794c51fe114f85ba0c_0.js:18
success
E.extend.ajax.c

I'm sure this has to do with one of the many billion .js files that drupal uses, but I'm having a lot of trouble trackin it down. Any help would be greatly appreciated!

Comments

merlinofchaos’s picture

If you turn off javascript aggregation it will be easier to determine exactly where that error is coming from.

Media Crumb’s picture

Its now turned off. The error remains. Thanks for any help!

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

What is the error message after disabling js aggregation?

Media Crumb’s picture

Same

ncaught TypeError: Object #<Object> has no method 'scrollTop'
$.each.$.filter.filter.each.$.addClass.find.each.$.click.$.ajax.successjs_ae2f29664b5756794c51fe114f85ba0c_0.js:18
success
E.extend.ajax.c
Media Crumb’s picture

A little more info. The problem seems to be on line 143 of the ajax-views.js file

              $(this).click(function () {
                $.extend(viewData, Drupal.Views.parseViewArgs($(this).attr('href'), settings.view_base_path));
                $(this).addClass('views-throbbing');
                $.ajax({
                  url: ajax_path,
                  type: 'GET',
                  data: viewData,
                  success: function(response) {
                    $(this).removeClass('views-throbbing');
                    // Scroll to the top of the view. This will allow users
                    // to browse newly loaded content after e.g. clicking a pager
                    // link.
                    var offset = $(target).offset();
                    // We can't guarantee that the scrollable object should be
                    // the body, as the view could be embedded in something
                    // more complex such as a modal popup. Recurse up the DOM
                    // and scroll the first element that has a non-zero top.
                    var scrollTarget = target;
                    while ($(scrollTarget).scrollTop() == 0 && $(scrollTarget).parent()) {
<strong>Issue here :Uncaught TypeError: Object #<Object> has no method 'scrollTop'</strong>
                      scrollTarget = $(scrollTarget).parent()
                    }
                    // Only scroll upward
                    if (offset.top - 10 < $(scrollTarget).scrollTop()) {
                      $(scrollTarget).animate({scrollTop: (offset.top - 10)}, 500);
                    }
                    // Call all callbacks.
                    if (response.__callbacks) {
                      $.each(response.__callbacks, function(i, callback) {
                        eval(callback)(target, response);
                      });
                    }
                  },
                  error: function(xhr) { $(this).removeClass('views-throbbing'); Drupal.Views.Ajax.handleErrors(xhr, ajax_path); },
                  dataType: 'json'
                });

 
esmerel’s picture

Status: Postponed (maintainer needs more info) » Active
dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Just by looking at ajax_view.js it totally! looks different from the part you posted ...

Drupal.ajax.prototype.commands.viewsScrollTop = function (ajax, response, status) {
  // Scroll to the top of the view. This will allow users
  // to browse newly loaded content after e.g. clicking a pager
  // link.
  var offset = $(response.selector).offset();
  // We can't guarantee that the scrollable object should be
  // the body, as the view could be embedded in something
  // more complex such as a modal popup. Recurse up the DOM
  // and scroll the first element that has a non-zero top.
  var scrollTarget = response.selector;
  while ($(scrollTarget).scrollTop() == 0 && $(scrollTarget).parent()) {
    scrollTarget = $(scrollTarget).parent();
  }
  // Only scroll upward
  if (offset.top - 10 < $(scrollTarget).scrollTop()) {
    $(scrollTarget).animate({scrollTop: (offset.top - 10)}, 500);
  }
};

Just a guess, do you use views on drupal6 here or a really old version of views. Issues can only be fixed in current version of the code.

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)