2

I have a view of user accounts.

I want to allow visitors to the site to choose to sortthis view by login date or by account creation date in a view (Views 3, Drupal 7).

It's easy to expose the sort operator to users, but is there a way to let users select which sort is applied first (creation date or login date)?

I thought about just cloning the view, and then changing the sort on the second view and linking them together, but if possible I would like to avoid duplication.

4
  • how about sortable headers? I don't know if it goes two levels though
    – Geoff
    May 21, 2015 at 19:25
  • @Geoff For this view, I'm using Views Fluid Grid to manage the display (the view shows user profiles, and I'm using fluid grid because it works responsively), so unfortunately the sortable table headers won't help me, but that's a good idea. May 22, 2015 at 0:53
  • the next option I might look at is a custom form inserted into the views header that creates the search url and refreshes the page. This way you could customise the layout and behaviour of the form and set the url appropriately
    – Geoff
    May 22, 2015 at 1:32
  • 1
    You could probably do that with drupal.org/project/better_exposed_filters to accomplish this, I've combined two sorts together that way before, one selected with Ajax refreshing sort, then having the secondary sort tied in with the same. I would checkout the handbook links on that page for more direction, they have some pretty extensive recipes there that you could use as a base to start from. May 22, 2015 at 4:59

1 Answer 1

1

You can do that with Better Exposed Filters. I've combined two sorts together that way before, one selected with Ajax refreshing sort, then having the secondary sort tied in with the same. I would checkout the handbook links on that page for more direction, they have some pretty extensive recipes there that you could use as a base to start from.

handbook page for further reference

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.