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
Comment #1
zambrey commentedLooks like #1877446: Fix Ajax pager in nested views is related.
Comment #2
dawehnerAlso #1786524: AJAX pager does not work if page number set in URL could be related.
Comment #3
jpstrikesback commentedAlso seeing this in a block view pager that is using Ajax.
Comment #4
darren oh