How do I create an AJAX filter for a view?
-
16-10-2019 - |
Question
I have created a page using Views and it works fine. I want to add an AJAX filter to this page to allow visitors to filter the contents based on PubDate or by Taxonomy/Vocabulary for this content type. How can I accomplish this?
Solution
Edit the view, and add a filter to the page:
- Drupal 6: Third column, section is called Filters
- Drupal 7: First column, section is called Filter Criteria
When you configure the filter, you want to expose it:
- Drupal 6: Click the Expose button in the top right of the configure area
- Drupal 7: Check Expose this filter to visitors, to allow them to change it
Enable AJAX:
- Drupal 6: Use AJAX is under Basic settings in the first column
- Drupal 7: Use AJAX is under Advanced → Other in the third column
When the view is saved, there will now be a form that'll allow users to filter the view dynamically via AJAX.
OTHER TIPS
Maybe, you can use the Better exposed filters module to change output of your filter items to links.
And Use AJAX option in Advanced settings of a view to make filtering ajaxifyed.
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange