Goal:

dynamically insert View on click with ajax-enabled pager

Problem:

Pager doesn't work on such view.

Code:

I'm using Ajax Framework so I guess everything should work as expected.
I have a link on page:
<a class="use-ajax" href="/helfy_forum/nojs/2482">expand</a>

My hook_menu() along with callback:

function helfy_menu() {
  $items = array();

  $items['helfy_forum/%/%node'] = array(
    'page callback' => 'helfy_forum_callback',
    'page arguments' => array(1, 2),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function helfy_forum_callback($js, $node) {
  if ($js == 'nojs') {
    drupal_goto('node/' . $node->nid);
  }
  $view = views_get_view('comments');
  $output = $view->preview('page', array($node->nid));
  $commands = array();
  $commands[] = ajax_command_replace('#comment-box-' . $node->nid, $output);
  print ajax_render($commands);
}

So my View is loading fine but the pager doesn't work.
What I'm missing here? What should I do to enable Ajax on pager?

Thanks,
Adam

Comments

zambrey’s picture

dawehner’s picture

jpstrikesback’s picture

Also seeing this in a block view pager that is using Ajax.

darren oh’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)
Related issues: +#1877446: Fix Ajax pager in nested views