Filtering - Sorting(dropdown)

Hi Maddy,

Please follow the example exactly as a starting point as it functionally does exactly what you want without any changes.

The Order by area (on the left hand side) in the Query Editor determines which field is used for sorting (i.e. date, name).

The Order area (on the right hand side) in the Query Editor determines the sort direction (i.e. ASC, DESC).

What you are wanting to do is dynamically change the direction dropdown’s labels for ASC / DESC depending on which field is selected to be ordered by.

I don’t have time to create an example of this right now but probably the quickest way to do it is to use javascript to update the direction select dropdown labels when the selected value of the orderby select dropdown changes.

Aside from these labels (newest first), (oldest first), (A-Z) and (Z-A), it should behave exactly as you want without any modifications. You can change the labels themselves to whatever text you want, so for example: “(Ascending)” and “(Descending)”, as long as the values remain as ASC and DESC.