7

I'm experimenting with a "page" view, and would like to submit the view's exposed filters via Ajax, but not the same views pager.(I currently have a checkbox "has taxonomy term" filter that has been enhanced by the BEF module.)

Currently if I select "Use Ajax: Yes" in the "Advanced" column of the views settings, both the pager and exposed filter are submitted via Ajax. Is there a way to make it so that only the exposed filter submits via Ajax, and the pager reloads the page with the default "?page=X' GET parameter?

I was thinking I could leave "Use Ajax: No" in the view settings, and then somehow add the ajax functionality to the exposed form, via some hook. (form_alter?) Or maybe add some inline javascript which disables the ajax functionality of the pager? (which isn't even a form.)

Hoping someone could point me in the right path. (Using Drupal 7 and Views 3)

3

I'm sure you've found a solution / workaround for this by now, but this thread came up while I was faced with the same issue, so I figured I'd share the solution that worked for me.

All I did was simply remove Drupal's AJAX event handler from the pager links using jQuery's unbind method, e.g.:

$('.pager a').unbind();

With the event handlers removed, the pagination links fall back on the HREF URLs contained within the anchor tags.

  • This method works ok, except the pager will remain unbound even when the user changes a filter value, which is undesirable because the new list will not start on the first page of that list, it will start on whatever number at which the pager was last set. There must be a way to start the pager over on this kind of event, I'm going to try some things. – steve Mar 5 '15 at 22:00
1

I don't think what you're describing will be easy, due to the nature of the ajax function.

just thinking outloud (in type?) here: leave ajax on, limit results to 25. add an offset filter to the contextual filters, the default being "0". use a custom paging function (custom footer in view? template?) and generate links with the offset (and your form values?) for use by your contextual filters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.