How is this supposed to work?

In a view, I've set Use pager:Infinite Scroll | Infinite Scroll, Items per page: 2, Ajax: no, Show: fields.

What else am I supposed to do to get this to work?

If I inspect the page, I see the jquery.autopager-1.0.0.js has loaded as well as the views_infinite_scroll.js file.

All that happens is 2 items are loaded. No scrolling.

Any ideas?

Comments

tinny’s picture

bump

tinny’s picture

If i enable ajax on the view i get the error 'Views infinite scroll pager is not compatible with Ajax Views. Please disable "Use Ajax" option.' so i atleast know views_infinite_scroll.js is being read.

There are no javascript errors.

tinny’s picture

More info: the last list item of the the pager (the pager is hidden with display:none), is <li class="pager-next last">Array</li>

mr_wookie’s picture

Do you than have more items than fit in the viewport? It only works when the scrollbar shows apparently...

tinny’s picture

Yep. Scroll bar showing 12 items with 3 pages.

I also installed jquery_update so now my jquery version is at v1.5.2.

jQuery.autopager v1.0.0

views module 7.x-3.1
views infinite scroll module 7.x-1.0

I do get this warning in chrome but i dont think its related

event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.

tinny’s picture

It doesnt work in any browser on a mac or on a windows vm.

tinny’s picture

Some more info:

Doesnt work with any other field display eg. table, grid, html list or unformatted.

Turning Infinite views off, i enabled ajax with full pager and ajax works fine.

Im displaying title and body fields.

tinny’s picture

Found the problem. It was the theme.

Works in Bartik and all the default themes.

Does not work with Tao theme or Tao sub-themes.

tinny’s picture

Specifically, the problem lies in Tao's template.php with the function tao_pager_link($vars)

This is the code:

/**
 * Return an array suitable for theme_links() rather than marked up HTML link.
 */
function tao_pager_link($vars) {
  $text = $vars['text'];
  $page_new = $vars['page_new'];
  $element = $vars['element'];
  $parameters = $vars['parameters'];
  $attributes = $vars['attributes'];

  $page = isset($_GET['page']) ? $_GET['page'] : '';
  if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
    $parameters['page'] = $new_page;
  }

  $query = array();
  if (count($parameters)) {
    $query = drupal_get_query_parameters($parameters, array());
  }
  if ($query_pager = pager_get_query_parameters()) {
    $query = array_merge($query, $query_pager);
  }

  // Set each pager link title
  if (!isset($attributes['title'])) {
    static $titles = NULL;
    if (!isset($titles)) {
      $titles = array(
        t('« first') => t('Go to first page'),
        t('‹ previous') => t('Go to previous page'),
        t('next ›') => t('Go to next page'),
        t('last »') => t('Go to last page'),
      );
    }
    if (isset($titles[$text])) {
      $attributes['title'] = $titles[$text];
    }
    else if (is_numeric($text)) {
      $attributes['title'] = t('Go to page @number', array('@number' => $text));
    }
  }

  return array(
    'title' => $text,
    'href' => $_GET['q'],
    'attributes' => $attributes,
    'query' => count($query) ? $query : NULL,
  );
}

So to fix, in my template.php i added my own function mytheme_pager_link($variables) and put the default code from drupal back in there. See: http://api.drupal.org/api/drupal/includes%21pager.inc/function/theme_pag...

tinny’s picture

The above 'fix' actually breaks normal Views pagers.

So is this considered a Tao issue or a Views Infinite Scroll issue?

ademarco’s picture

The module's javascript behavior should actually be independent from how the theme handles pagination. I would propose to add an hidden html element containing a link to the next page: javascript behavior would use that field instead.

Yuri’s picture

Well, I use Bartik and I also can't get this module to work. Maybe the module should not be mentioned as stable on the project page.

Remon’s picture

Title: Doesnt work » VIS doesn't work with Tao theme

... or any theme that override pager theme function.

Remon’s picture

Category: support » feature
honza pobořil’s picture

Issue summary: View changes
Status: Active » Closed (outdated)