Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.1
Component:
block displays
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Dec 2008 at 13:39 UTC
Updated:
3 Mar 2009 at 13:46 UTC
I'm using this code to output a view in a block:
$view = views_get_view('bloggar');
$view->init();
$view->set_display('block_1');
$view->set_use_pager('mini');
$view->set_pager_element(0);
$view->set_arguments(array($arg));
$view->set_use_ajax(TRUE);
$view->set_offset(1);
$view->set_items_per_page(2);
return $view->render();
When use_ajax is set to TRUE, the pager bugs out, just appending results to the original rows, not paging them. When set to FALSE, paging works as expected.
I'm not really sure about what methods to call when rendering a view this way, so it might be that I'm missing something.
Comments
Comment #1
blackdog commentedWrong title.
Comment #2
nedjoI haven't looked at if/how ajax would work in this context.
Can you explain in more detail the result you get? Any Javascript errors? Can you point me (via my contact form) to an example site?
Comment #3
merlinofchaos commentedWhat if you use $view->preview() rather than $view->render()?
Comment #4
blackdog commentedSo now I've got the paging working, not really sure why though, because it's the same code as above, I've only changed the argument in the view to use user names, which works great.
Might have been a caching issue before, not sure. So it seems AJAX can work in this context, which is great! Thanks!
I've exported the view if you want to have a look.
Comment #6
summit commentedInteresting, bookmarking, greetings, Martijn