views:

520

answers:

3

I have some nodes I am displaying in a view. They are displayed as nodes, unformatted. I would like the user to be able to choose from some predefined sort criteria ( via drop down list or similar).

So they could pick recently active, most commented, newest, etc., and re-query for new results.

Its easy with tables because you can make the labels clickable, but I do not know how to have similar functionality with a raw node preview display.

A: 

Standard views isn't going to support this, so IMO you're best off implementing a custom solution using just a plain old view and this jQuery plugin. You can either do this at the theme layer (the same way as any other JS in a theme) or a custom module (via drupal_add_js() to add the plugin and your bit of custom code). Either way will work, although the custom module has the obvious benefit of being theme independent (and thus more portable).

If you go the custom module route, please consider releasing it as a contrib module on http://drupal.org.

Mike Crittenden
+1  A: 

Just a thought, from me to me, and for anyone else who may be trying to do this.

An easy, sleezy option would be to just add another page view for each of the required sorts, and provide a link to these other views in the header of each of the pages.

This could also allow for (easier) linking to the individual sorts, so say if you have a sidebar block displaying recently commented nodes, you could adjust the .tpl.php of the block to have the title link to the view displaying the full set of recently commented nodes.

also im pretty sure there should be a way to do this with arguments, but i dont know how

Douglas
This is what I ended up doing, works great, and looks fine
Douglas
A: 

Views 3 supports exposing sort order (just like you can expose filters)

Sid NoParrots

related questions