Yo, a while back I said I'd contribute back some ajax stuff I did with your module. So here's the basics:

Implementation of a new menu call to return json data:

  $items[] = array(
    'path' => 'myplay/artists-a-z',
    'callback' => 'myplay_artists_alpha_listing',
    'callback arguments' => $_GET['apage'],
    'type' => MENU_CALLBACK,
    'access' => TRUE,
  );

corresponding menu callback function:

// this is for the ajax call used on the frontpage to replicate what views_alphapager returns
function myplay_artists_alpha_listing() {
  $args = func_get_args();
  $view = views_get_view('artists_pager');
  $output = views_build_view('page', $view, $args, FALSE);
  $output = str_replace($view->alpha_pager_output, '', $output);  // might be a better way?
  print $output;
  exit;
}

a little jquery:

$(document).ready(function(){  
  old = $('.apager .pager-list strong').html();
  $('.apager .pager-list strong').wrap("<a title='Go to " + old + " listings' class='pager-next active' href='/front?apage=" + old + "#artist-alpha'></a>");
  $('.apager .pager-list a').click(function(){
    target = $(this).html();
    data = "apage=" + target;
    old = $('.apager .pager-list strong').html();
    $('.apager .pager-list strong').parent().html(old);
    $(this).html("<strong class='pager-current'>" + target + "</strong>");
    $(".view-artists-pager").html("<center><h3>Loading</h3></center>");      // This should be themed somehow, didn't work out how yet
    $.ajax({
      url: "myplay/artists-a-z",
      data: data,
      success: function(html){
        $(".view-artists-pager").html(html);
      }
    });
    return false;
  });
});

I did most of this in my site's custom module and didn't really hack up alpha pager, so I've not provided a patch, but if anyone finds this useful I figured it be a good place to post this.

Comments

pomliane’s picture

Status: Active » Closed (won't fix)

This version of Views Alpha Pager is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.