I have a content type "news" and a views page to list the news. The views contains a exposed filter (category and year).

How can I realize the select list "Year" with the follwing options as exposed filter:

  • All
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012

When the user selects '2015' the list below is updatet (ajax) and only news entry form 2015 are listed.

How can I realize this?

2 Answers 2

  1. Add filter criteria of Year field.
  2. Now expose this field by selecting 'Expose this filter to visitors, to allow them to change it' option from field setting.
  3. For Ajax behaviour, choose Use AJAX from advance view section.
  • Okay, thank you. There is no field year but a field "date" and the granularity can be set to "year". The question is now how to change the order of the select list entries vom "2010, 2011, 2012 ..." to "2016, 2015, 2014, 2013, ...". Is this possible to change the order of the exposed select list??? Howß
    – drupalfan
    Oct 25, 2016 at 15:50
  • Use form_alter hook. Oct 27, 2016 at 14:23
  • How can I do this?
    – drupalfan
    Oct 27, 2016 at 19:30
  • See my answer below for a screenshot... Nov 19, 2019 at 4:56

Using Views, you will need to use a contextual filter based on the year. For the exposed filter, I have utilized the settings for the date like so:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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